PS: this is the wasm-ld cmdline:

em++: error: '/Users/floh/projects/fips-sdks/emsdk/upstream/bin/wasm-ld -o 
/Users/floh/projects/fips-deploy/sokol-samples/sapp-webgl2-wasm-vscode-release/spine-sapp.wasm
 
sapp/CMakeFiles/spine-sapp.dir/spine-sapp.c.obj 
sapp/CMakeFiles/spine-sapp.dir/spine-assets.c.obj libs/sokol/libsokol.a 
libs/spine-c/libspine-c.a libs/stb/libstb.a libs/util/libfileutil.a 
fips-cimgui_cimgui/libcimgui.a 
-L/Users/floh/projects/fips-sdks/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/lto
 
-lGL-webgl2 -lal -lhtml5 -lstubs -lc -lcompiler_rt -lc++-noexcept 
-lc++abi-noexcept -lemmalloc -lc_rt -lsockets -mllvm 
-combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm 
-disable-lsr 
--allow-undefined-file=/var/folders/dz/g9ydwg8973z9nn5bvffcwf3h0000gn/T/tmphqvycm26.undefined
 
--strip-debug --export-if-defined=main --export-if-defined=stackSave 
--export-if-defined=stackRestore --export-if-defined=stackAlloc 
--export-if-defined=__wasm_call_ctors --export-if-defined=__errno_location 
--export-if-defined=malloc --export-if-defined=free 
--export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm 
--export-table -z stack-size=5242880 --initial-memory=33554432 --entry=main 
--max-memory=2147483648 --global-base=1024' failed (returned 1)

...I'm now trying to bisect the SDK version to see if this is a 
regression...

On Saturday, 3 September 2022 at 15:03:21 UTC+2 Floh wrote:

> I just stumbled over a very weird problem in a new sample for my sokol 
> headers which includes a non-trivial 3rd party C library - the spine-c 
> runtime (
> https://github.com/EsotericSoftware/spine-runtimes/tree/4.1/spine-c/spine-c
> )
>
> When building in release mode (but not in debug mode) the linker complains 
> about an unresolved 'calloc' call. Adding detailed output 
> via LLD_REPORT_UNDEFINED=1 I get tons of:
>
> wasm-ld: error: 
> /Users/floh/projects/fips-sdks/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libemmalloc.a(emmalloc.o):
>  
> undefined symbol: calloc
>
> ... how does that even make sense when emmalloc is supposed to provide an 
> implementation of calloc... anyway...
>
> The error goes away when compiling in debug mode (some differences that 
> come to mind to the release mode is that debug mode doesn't use -flto, and 
> also doesn't run the closure compiler).
>
> The problem also goes away when not building with emmalloc.
>
> Now the weird thing is that the entire code this sample is built from 
> doesn't appear to call calloc anywhere... and that other samples which 
> actually use calloc build just fines.
>
> Has anybody seen a similar problem yet, before I jump myself into the 
> rabbit hole? :)
>
> The problematic command line is:
>
> em++ -s DISABLE_EXCEPTION_CATCHING=1  -fno-exceptions -fno-rtti 
> -fstrict-aliasing -Wall -Wno-multichar -Wextra -Wno-unknown-pragmas 
> -Wno-ignored-qualifiers -Wno-long-long -Wno-overloaded-virtual 
> -Wno-deprecated-writable-strings -Wno-unused-volatile-lvalue 
> -Wno-inconsistent-missing-override -Wno-warn-absolute-paths 
> -Wno-expansion-to-defined  -flto -O3 -DNDEBUG -s 
> DISABLE_EXCEPTION_CATCHING=1  --memory-init-file 0 -s 
> INITIAL_MEMORY=33554432 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s 
> NO_EXIT_RUNTIME=1 -s LLD_REPORT_UNDEFINED=1 -s ALLOW_MEMORY_GROWTH=1 -s 
> USE_WEBGL2=1 -s "MALLOC='emmalloc'" -s NO_FILESYSTEM=1 -s WASM=1 
>  --shell-file /Users/floh/projects/sokol-samples/webpage/shell.html -O3 
>  -flto  --closure 1 -s ASSERTIONS=0 
> sapp/CMakeFiles/spine-sapp.dir/spine-sapp.c.obj 
> sapp/CMakeFiles/spine-sapp.dir/spine-assets.c.obj -o 
> /Users/floh/projects/fips-deploy/sokol-samples/sapp-webgl2-wasm-vscode-release/spine-sapp.html
>  
>  libs/sokol/libsokol.a  libs/spine-c/libspine-c.a  libs/stb/libstb.a 
>  libs/util/libfileutil.a  fips-cimgui_cimgui/libcimgui.a
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/53dde1aa-b8b4-4843-9a0d-636e5df32b73n%40googlegroups.com.

Reply via email to