Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emscripten build broken on Mac OS #827

Open
dpk opened this issue Apr 17, 2022 · 1 comment
Open

Emscripten build broken on Mac OS #827

dpk opened this issue Apr 17, 2022 · 1 comment

Comments

@dpk
Copy link
Contributor

dpk commented Apr 17, 2022

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.
@winstonwolff
Copy link

winstonwolff commented Mar 24, 2023

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

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

No branches or pull requests

2 participants