Trying to build executable on Mac M1
Building the executable crashes with Error:
clang -flto -g -Wall -MMD -MF ./.obj/index.o.d -Wno-array-bounds -D_GNU_SOURCE -O2 -flto -c -I/usr/local/include/quickjs -o .obj/index.o index.c
index.c:70736:16: error: redefinition of 'qjsc_index_size'
const uint32_t qjsc_index_size = 1125;
^
index.c:5819:16: note: previous definition is here
const uint32_t qjsc_index_size = 219;
^
index.c:70738:15: error: redefinition of 'qjsc_index' with a different type: 'const uint8_t[1125]' vs 'const uint8_t[219]'
const uint8_t qjsc_index[1125] = {
^
index.c:5821:15: note: previous definition is here
const uint8_t qjsc_index[219] = {
^
2 errors generated.
make: *** [.obj/index.o] Error 1
Running qjs the code runs fine. Removing everything except the QuickWebServer still crashes the compilation.
OS: MacOS Montery 12.6 (21G115) - Apple M1 Pro QuickJS: Version 2021-03-27 @lyohaplotinka/quickwebserver: Version 0.0.3
Happy to provide any other details. I'm planning to use this as an executable with an embedded react interface and a web server. Awesome work you've done here so far.
I may try compiling via docker image next. Does there happen to be a distro that has proven to work for compilation in the past?
I forgot to mention that I followed the instructions as described here when trying to compile. The output above is from make.
Tested building on node:alpine in docker leads to a similar result, unfortunately:
Step 9/10 : RUN export CPATH=/usr/include/quickjs && make
---> Running in 0453bee48f12
mkdir -p ./.obj
gcc -flto -g -Wall -MMD -MF ./.obj/quickwebserver.o.d -Wno-array-bounds -D_GNU_SOURCE -O2 -flto -c -I/usr/local/include/quickjs -o .obj/quickwebserver.o /work/node_modules/@lyohaplotinka/quickwebserver/c/quickwebserver.c
qjsc -flto -D /work/node_modules/@lyohaplotinka/quickwebserver/src/worker/server_worker.build.js -e -M quickwebserver,quickwebserver -m -o index.c ./index.js
gcc -flto -g -Wall -MMD -MF ./.obj/index.o.d -Wno-array-bounds -D_GNU_SOURCE -O2 -flto -c -I/usr/local/include/quickjs -o .obj/index.o index.c
index.c:6971:16: error: redefinition of 'qjsc_index_size'
6971 | const uint32_t qjsc_index_size = 1100;
| ^~~~~~~~~~~~~~~
index.c:5819:16: note: previous definition of 'qjsc_index_size' with type 'uint32_t' {aka 'const unsigned int'}
5819 | const uint32_t qjsc_index_size = 219;
| ^~~~~~~~~~~~~~~
index.c:6973:15: error: conflicting types for 'qjsc_index'; have 'const uint8_t[1100]' {aka 'const unsigned char[1100]'}
6973 | const uint8_t qjsc_index[1100] = {
| ^~~~~~~~~~
index.c:5821:15: note: previous definition of 'qjsc_index' with type 'const uint8_t[219]' {aka 'const unsigned char[219]'}
5821 | const uint8_t qjsc_index[219] = {
| ^~~~~~~~~~
make: *** [Makefile:40: .obj/index.o] Error 1