Description
This could just be totally expected and I overlooked something obvious on my end, so I apologize if so. But, I'd like to be able to export abort (or maybe exit? that also fails FYI) to be able to hot load/reload tree-sitter parser modules, sometimes these use abort/exit
if a memory allocation fails, hence the usage of abort
or exit
. I'd appreciate any insight/alternatives! Thanks.
Version of emscripten/emsdk:
Please include the output emcc -v
here
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.53-git (ce5114b)
clang version 19.0.0git (/startdir/llvm-project febb4c42b192ed7c88c17f91cb903a59acf20baf)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /opt/emscripten-llvm/bin
Failing command line in full:
If this is compile or link-time failure please include the full failing command
along with its entire output.
#!/usr/bin/bash
set -e
emcc \
-o stdlib.wasm \
-Os \
-v \
--no-entry \
-s MAIN_MODULE=2 \
-s "EXPORTED_FUNCTIONS=_abort" \
-s 'ALLOW_MEMORY_GROWTH' \
-s 'TOTAL_MEMORY=4MB' \
-fvisibility=hidden \
-fno-exceptions \
-xc \
/dev/null
Full link command and output with -v
appended:
Even for runtime issues it helps a lot if you can include the full link command.
Adding -v
to the link command will show all of the sub-commands run which
can help us diagnose your issue.
/opt/emscripten-llvm/bin/clang -target wasm32-unknown-emscripten -fignore-exceptions -fPIC -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --sysroot=/home/amaanq/.emscripten_cache/sysroot -DEMSCRIPTEN -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/fakesdl -Xc
lang -iwithsysroot/include/compat -Os -v -fvisibility=hidden -fno-exceptions -xc /dev/null -c -o /tmp/emscripten_temp_s2chziwb/null_0.o
clang version 19.0.0git (/startdir/llvm-project febb4c42b192ed7c88c17f91cb903a59acf20baf)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /opt/emscripten-llvm/bin
(in-process)
"/opt/emscripten-llvm/bin/clang-19" -cc1 -triple wasm32-unknown-emscripten -emit-obj -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name null -mrelocation-model pic -pic-level 2 -mframe-pointer=none -ffp-contract=on -fno-rounding-math -mconstructor-aliases -target-feature +mutabl
e-globals -target-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/amaanq/projects/tree-sitter -v -fcoverage-compilation-dir=/home/amaanq/projects/tree-sitter -resource-dir /opt/emscripten-llvm/lib/clang/19 -D EMSCRIPTEN -isysroot /home/amaanq/.emscripten_cache/sysroot -internal-isystem /opt/emscripten-llvm/lib/cl
ang/19/include -internal-isystem /home/amaanq/.emscripten_cache/sysroot/include/wasm32-emscripten -internal-isystem /home/amaanq/.emscripten_cache/sysroot/include -Os -Werror=implicit-function-declaration -ferror-limit 19 -fvisibility=hidden -fgnuc-version=4.2.1 -fignore-exceptions -fcolor-diagnostics -vectorize-loops -vectoriz
e-slp -iwithsysroot/include/fakesdl -iwithsysroot/include/compat -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -o /tmp/emscripten_temp_s2chziwb/null_0.o -x c /dev/null
clang -cc1 version 19.0.0git based upon LLVM 19.0.0git default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/home/amaanq/.emscripten_cache/sysroot/include/wasm32-emscripten"
#include "..." search starts here:
#include <...> search starts here:
/home/amaanq/.emscripten_cache/sysroot/include/fakesdl
/home/amaanq/.emscripten_cache/sysroot/include/compat
/opt/emscripten-llvm/lib/clang/19/include
/home/amaanq/.emscripten_cache/sysroot/include
End of search list.
/opt/emscripten-llvm/bin/clang --version
cache:INFO: generating system asset: symbol_lists/8def5820facfabff0785b3226fd9258b81c08609.json... (this will be cached in "/home/amaanq/.emscripten_cache/symbol_lists/8def5820facfabff0785b3226fd9258b81c08609.json" for subsequent builds)
/usr/bin/node /usr/lib/emscripten/src/compiler.mjs /tmp/tmpy8_on035.json --symbols-only
cache:INFO: - ok
/opt/emscripten-llvm/bin/wasm-ld -o stdlib.wasm /tmp/emscripten_temp_s2chziwb/null_0.o -L/home/amaanq/.emscripten_cache/sysroot/lib/wasm32-emscripten/pic /home/amaanq/.emscripten_cache/sysroot/lib/wasm32-emscripten/pic/crt1_reactor.o -lGL-getprocaddr -lal -lhtml5 -lstandalonewasm-nocatch-memgrow -lstubs -lnoexit -lc -ldlmalloc
-lcompiler_rt -lc++-noexcept -lc++abi-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr /tmp/tmpjuwuou71libemscripten_js_symbols.so --import-memory --strip-debug --export=stackSave --export=stackRestore --export=setThrew --export=malloc --export-if-defined=__star
t_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=__wasm_apply_data_relocs --experimental-pic --unresolved-symbols=import-dynamic -pie --no-export-dynamic -z stack-size=6
5536 --initial-memory=4194304 --max-memory=2147483648 --entry=_initialize
/opt/emscripten-llvm/bin/llvm-objcopy stdlib.wasm stdlib.wasm --remove-section=.debug* --remove-section=producers
/usr/bin/wasm-emscripten-finalize --dyncalls-i64 --no-legalize-javascript-ffi --standalone-wasm stdlib.wasm -o stdlib.wasm --detect-features
emcc: error: undefined exported symbol: "_abort" [-Wundefined] [-Werror]