chibi-scheme
chibi-scheme copied to clipboard
Emscripten build broken on Mac OS
The Makefile appears to be confused at points between the flags and environment variables needed for (native) static builds on Mac OS and those needed for a static Emscripten build.
cc -Wall -DSEXP_USE_DL=0 -g -g3 -O3 -static -DSEXP_USE_DL=0 -o chibi-scheme-static main.o gc.o sexp.o bignum.o gc_heap.o opcodes.o vm.o eval.o simplify.o -lm -ldl
ld: library not found for -lcrt0.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Explicitly passing the right static build flags for Mac OS (make js 'STATICFLAGS=-DSEXP_USE_DL=0'
) fixes this, but then it seems it gets stuck because the #ifdef
maze used for parts of OS interface interface handling apparently ends up not defining a few functions:
/usr/local/Cellar/emscripten/3.1.8/libexec/emcc -c -DSEXP_USE_STRICT_TOPLEVEL_BINDINGS=1 -DSEXP_USE_ALIGNED_BYTECODE=1 -DSEXP_USE_STATIC_LIBS=1 -DSEXP_USE_STATIC_LIBS_NO_INCLUDE=0 -Iinclude -DSEXP_USE_INTTYPES -Wall -DSEXP_USE_DL=0 -g -g3 -O3 -O2 -fPIC -o eval.o eval.c
In file included from eval.c:1376:
./clibs.c:6450:32: error: implicit declaration of function 'login_tty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
res = sexp_make_integer(ctx, login_tty((sexp_filenop(arg0) ? sexp_fileno_fd(arg0) : sexp_unbox_fixnum(arg0))));
^
./clibs.c:6732:9: error: implicit declaration of function 'sexp_pid_cmdline' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
res = sexp_pid_cmdline(ctx, sexp_sint_value(arg1));
^
./clibs.c:6732:7: warning: incompatible integer to pointer conversion assigning to 'sexp' (aka 'struct sexp_struct *') from 'int' [-Wint-conversion]
res = sexp_pid_cmdline(ctx, sexp_sint_value(arg1));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 2 errors generated.
I'm getting this too. I'm running MacOS Ventura 13.2.1. I'm happy to poke around if someone can guide me.
I'm trying with 'chibi-scheme' commit d5e8587, Mar 19, 2023
% emcc --version
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.34-git