Skip to content
This repository has been archived by the owner on Nov 23, 2020. It is now read-only.

Failed to build on Windows, errors in compile.c #51

Open
ghost opened this issue Aug 13, 2020 · 4 comments
Open

Failed to build on Windows, errors in compile.c #51

ghost opened this issue Aug 13, 2020 · 4 comments

Comments

@ghost
Copy link

ghost commented Aug 13, 2020

@H2CO3 @jcubic @mattfenwick @sfan5 @idmitrievsky

macOS/Linux/iOS - successfully compiled.

Windows:

sed: -e expression #1, char 1: unknown command: `''
sed: -e expression #1, char 1: unknown command: `''
gcc -c -std=c89 -pedantic -fpic -fstrict-aliasing -Wall -Wextra -Werror -Wno-error=unused-function -Wno-error=sign-compare -Wno-parentheses -Wno-error=pointer-to-int-cast -Wno-error=uninitialized -Wno-unused-parameter -Wno-missing-field-initializers -Wno-error=pedantic -D_XOPEN_SOURCE=700 -DSPARKLING_LIBDIR_RAW="/usr/local/lib/sparkling/" -DUSE_LIBEDIT=1 -DUSE_ANSI_COLORS=1 -DUSE_DYNAMIC_LOADING=1 -O0 -g -pg -DDEBUG -o bld/api.o src/api.c
src/api.c: In function 'spn_object_description':
src/api.c:91:3: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   (unsigned long)(obj)
   ^
src/api.c: In function 'spn_hash_value':
src/api.c:350:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   return (unsigned long)(ptrvalue(key));
          ^
src/api.c:355:33: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   return hashfn ? hashfn(obj) : (unsigned long)(obj);
                                 ^
In file included from src/misc.h:14,
                 from src/api.c:22:
src/api.c: In function 'spn_typetag_name':
src/api.c:508:14: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
  assert(ttag < COUNT(typenames));
              ^
gcc -c -std=c89 -pedantic -fpic -fstrict-aliasing -Wall -Wextra -Werror -Wno-error=unused-function -Wno-error=sign-compare -Wno-parentheses -Wno-error=pointer-to-int-cast -Wno-error=uninitialized -Wno-unused-parameter -Wno-missing-field-initializers -Wno-error=pedantic -D_XOPEN_SOURCE=700 -DSPARKLING_LIBDIR_RAW="/usr/local/lib/sparkling/" -DUSE_LIBEDIT=1 -DUSE_ANSI_COLORS=1 -DUSE_DYNAMIC_LOADING=1 -O0 -g -pg -DDEBUG -o bld/array.o src/array.c
gcc -c -std=c89 -pedantic -fpic -fstrict-aliasing -Wall -Wextra -Werror -Wno-error=unused-function -Wno-error=sign-compare -Wno-parentheses -Wno-error=pointer-to-int-cast -Wno-error=uninitialized -Wno-unused-parameter -Wno-missing-field-initializers -Wno-error=pedantic -D_XOPEN_SOURCE=700 -DSPARKLING_LIBDIR_RAW="/usr/local/lib/sparkling/" -DUSE_LIBEDIT=1 -DUSE_ANSI_COLORS=1 -DUSE_DYNAMIC_LOADING=1 -O0 -g -pg -DDEBUG -o bld/ast.o src/ast.c
gcc -c -std=c89 -pedantic -fpic -fstrict-aliasing -Wall -Wextra -Werror -Wno-error=unused-function -Wno-error=sign-compare -Wno-parentheses -Wno-error=pointer-to-int-cast -Wno-error=uninitialized -Wno-unused-parameter -Wno-missing-field-initializers -Wno-error=pedantic -D_XOPEN_SOURCE=700 -DSPARKLING_LIBDIR_RAW="/usr/local/lib/sparkling/" -DUSE_LIBEDIT=1 -DUSE_ANSI_COLORS=1 -DUSE_DYNAMIC_LOADING=1 -O0 -g -pg -DDEBUG -o bld/compiler.o src/compiler.c
In file included from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/x86_64-w64-mingw32/include/windef.h:8,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/x86_64-w64-mingw32/include/Windows.h:69,
                 from src/misc.h:22,
                 from src/compiler.c:21:
src/compiler.c:407:16: error: expected identifier or '(' before 'int'
 static int max(int x, int y)
                ^~~
src/compiler.c:407:12: error: expected ')' before '>' token
 static int max(int x, int y)
            ^~~
src/compiler.c:407:12: error: expected ')' before '?' token
 static int max(int x, int y)
            ^~~
In file included from src/misc.h:14,
                 from src/compiler.c:21:
src/compiler.c: In function 'search_upvalues':
src/compiler.c:592:47: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
   assert(spn_array_count(node->index_to_desc) == upval_idx);
                                               ^~
src/compiler.c:614:46: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  assert(spn_array_count(node->index_to_desc) == flat_upvalidx);
                                              ^~
At top level:
src/compiler.c:706:13: warning: 'emit_ins_long' defined but not used [-Wunused-function]
 static void emit_ins_long(SpnCompiler *cmp, enum spn_vm_ins opcode,
             ^~~~~~~~~~~~~
make: *** [Makefile:124: bld/compiler.o] Error 1

OS: Windows 10
CPU: x86_64
GCC: 8.0.1

All requirements installed via mingw

Errors:

In file included from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/x86_64-w64-mingw32/include/windef.h:8,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/x86_64-w64-mingw32/include/Windows.h:69,
                 from src/misc.h:22,
                 from src/compiler.c:21:
src/compiler.c:407:16: error: expected identifier or '(' before 'int'
 static int max(int x, int y)
                ^~~
src/compiler.c:407:12: error: expected ')' before '>' token
 static int max(int x, int y)
            ^~~
src/compiler.c:407:12: error: expected ')' before '?' token
 static int max(int x, int y)
            ^~~

Place in code:

static int max(int x, int y)
{
	return x > y ? x : y;
}

I can't understand why this is an error. Maybe @H2CO3 can help me.

@enty8080
Copy link

@H2CO3 @lewek Same problem.

@ghost ghost changed the title Failed to build on Windows Failed to build on Windows, errors in compile.c Aug 13, 2020
@H2CO3
Copy link
Owner

H2CO3 commented Aug 13, 2020

The code is written in strictly conforming C89 – indeed the definition of this function shouldn't be an issue. It is suspicious that sed doesn't understand something – maybe try changing it to gsed? Some versions of sed differ wildly in what parameters they accept that it's not even funny.

@ghost
Copy link
Author

ghost commented Aug 13, 2020

@H2CO3 @enty8080 gsed does not helps. In Makefile sed used only to detecting OS.

This errors is not because sed problems, this is a Sparkling problems:

In file included from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/x86_64-w64-mingw32/include/windef.h:8,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/x86_64-w64-mingw32/include/Windows.h:69,
                 from src/misc.h:22,
                 from src/compiler.c:21:
src/compiler.c:407:16: error: expected identifier or '(' before 'int'
 static int max(int x, int y)
                ^~~
src/compiler.c:407:12: error: expected ')' before '>' token
 static int max(int x, int y)
            ^~~
src/compiler.c:407:12: error: expected ')' before '?' token
 static int max(int x, int y)
            ^~~

maybe my gcc is broken and does not know about C89, but this is very strange

@enty8080
Copy link

@H2CO3 @lewek I thought that the Sparkling is a cross-platform language.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants