I have a file called foo.c
which contains the line #include <gc.h>
, referencing the Boehm garbage collector library.
The emscripten documentation is says that external libraries must be compiled to bitcode first. So I compiled both 12.c
and gc.c
to bitcode using clang
and ran this command:
emcc 12.c gc.c
This compiles with warnings:
warning: incorrect target triple 'x86_64-apple-macosx10.11.0' (did you use emcc/em++ on all source files and not clang directly?)
warning: unresolved symbol: llvm_objectsize_i64_p0i8
Running a.out.js
gives me missing function: llvm_objectsize_i64_p0i8
.
I'm assuming this is related to the warning regarding not using clang directly.
However, when I try to compile to bitcode via emcc
it gives me the runaround and says
WARNING:root:emcc: cannot find library "gc"
fatal error: 'gc/gc.h' file not found
What am I doing wrong? Emscripten seems to be telling me I must use emcc
to compile libgc
but the documentation says I must compile to bitcode first.