Repository navigation
Closed
Description
I am testing out 64 bit memory with emscripten in an existing application that works great in 32 bit memory. Everything works in 64 bit except we are using the draco mesh compression (https://google.github.io/draco/ v 1.5.7) library which appear to trigger some invalid output (wasm-validator triggers an error).
I cannot provide the full source, but attached the draco static library we are building (libdraco.a.zip). I believe the error is triggered by the draco source code and not how specifically we use.
If you need any additional information, let me know.
Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.23 (7a5d93b50f6a3a35e85a0d2fc9e667b8498e6aed)
clang version 22.0.0git (https:/github.com/llvm/llvm-project 5243501cca02d7e54294d4bb5de0a85b06c40b7d)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /Users/dev/.local/share/mise/installs/emsdk/4.0.23/upstream/bin
Full link command and output with -v appended:
Link line with output
: && /Users/dev/.local/share/mise/installs/emsdk/4.0.23/upstream/emscripten/em++ -O3 -DNDEBUG -L/opt/homebrew/opt/llvm/lib/c++ -L/opt/homebrew/opt/llvm/lib/unwind -gline-tables-only -v -sALLOW_MEMORY_GROWTH=1 -sINITIAL_MEMORY=1536MB -lembind --emit-tsd lys.d.ts -sEXPORT_ES6=1 -sMODULARIZE=1 "-sENVIRONMENT='web'" -sUSE_WEBGL2=1 -sUSE_GLFW=3 -sMEMORY64=1 -sWASM=1 -sFETCH=1 "-sEXPORTED_FUNCTIONS=['_malloc','_main','_free']" -sEXPORTED_RUNTIME_METHODS=[\"allocateUTF8\",\"cwrap\",\"ccall\"] -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2 -sEXPORT_NAME=\"LysModule\" -sUSE_PTHREADS=1 "-sPTHREAD_POOL_SIZE=\"navigator.hardwareConcurrency * 2 + 5\"" -sEXIT_RUNTIME=1 -sASSERTIONS=0 CMakeFiles/foo.dir/src/foo.cpp.o -o bin/foo.js libftl.a libs/glm/glm/libglm.a libs/draco/draco/libdraco.a && :
/Users/dev/.local/share/mise/installs/emsdk/4.0.23/upstream/bin/clang --version
em++: warning: -pthread + ALLOW_MEMORY_GROWTH may run non-wasm code slowly, see https://github.com/WebAssembly/design/issues/1271 [-Wpthreads-mem-growth]
/Users/dev/.local/share/mise/installs/emsdk/4.0.23/upstream/bin/wasm-ld -o bin/foo.wasm /var/folders/rx/cml17gjj1yn5zzpf_7sl1l9w0000gn/T/tmpr_7h9wtalibemscripten_js_symbols.so --import-memory --shared-memory --export=malloc --export=free --export=_emscripten_stack_alloc --export=__getTypeName --export=_embind_initialize_bindings --export=_emscripten_thread_free_data --export=_emscripten_thread_crashed --export=__funcs_on_exit --export=__wasm_call_ctors --export=_emscripten_tls_init --export=_emscripten_thread_init --export=emscripten_stack_get_current --export=_emscripten_stack_restore --export=emscripten_stack_set_limits --export=_emscripten_thread_exit --export=malloc --export-if-defined=__start_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=main --export-if-defined=__main_argc_argv --export-if-defined=fflush --export-table -z stack-size=65536 --max-memory=2147483648 --initial-memory=1610612736 --no-entry --no-stack-first --table-base=1 --global-base=1024 -L/opt/homebrew/opt/llvm/lib/c++ -L/opt/homebrew/opt/llvm/lib/unwind -lembind-mt-rtti CMakeFiles/foo.dir/src/foo.cpp.o libftl.a libs/glm/glm/libglm.a libs/draco/draco/libdraco.a -L/Users/dev/.local/share/mise/installs/emsdk/4.0.23/upstream/emscripten/cache/sysroot/lib/wasm64-emscripten -L/Users/dev/.local/share/mise/installs/emsdk/4.0.23/upstream/emscripten/src/lib -lfetch-mt /Users/dev/.local/share/mise/installs/emsdk/4.0.23/upstream/emscripten/cache/sysroot/lib/wasm64-emscripten/crtbegin.o -lGL-mt-webgl2-getprocaddr -lal -lhtml5 -lstubs -lc-mt -ldlmalloc-mt -lcompiler_rt-mt -lc++-mt-noexcept -lc++abi-mt-noexcept -lsockets-mt -mwasm64 -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr
/Users/dev/.local/share/mise/installs/emsdk/4.0.23/upstream/bin/llvm-objcopy bin/foo.wasm bin/foo.wasm --remove-section=producers
/Users/dev/.local/share/mise/installs/emsdk/4.0.23/node/22.16.0_64bit/bin/node /Users/dev/.local/share/mise/installs/emsdk/4.0.23/upstream/emscripten/tools/compiler.mjs -
warning: JS library symbol '$allocateUTF8' is deprecated. Please open a bug if you have a continuing need for this symbol [-Wdeprecated]
em++: warning: warnings in JS library compilation [-Wjs-compiler]
/Users/dev/.local/share/mise/installs/emsdk/4.0.23/node/22.16.0_64bit/bin/node /Users/dev/.local/share/mise/installs/emsdk/4.0.23/upstream/emscripten/tools/compiler.mjs -
warning: JS library symbol '$allocateUTF8' is deprecated. Please open a bug if you have a continuing need for this symbol [-Wdeprecated]
em++: warning: warnings in JS library compilation [-Wjs-compiler]
/Users/dev/.local/share/mise/installs/emsdk/4.0.23/upstream/bin/wasm-opt --memory64-lowering --table64-lowering /var/folders/rx/cml17gjj1yn5zzpf_7sl1l9w0000gn/T/emscripten_temp_8kwnhvhp/tsgen.wasm -o /var/folders/rx/cml17gjj1yn5zzpf_7sl1l9w0000gn/T/emscripten_temp_8kwnhvhp/tsgen.wasm --mvp-features --enable-threads --enable-bulk-memory --enable-bulk-memory-opt --enable-call-indirect-overlong --enable-memory64 --enable-multivalue --enable-mutable-globals --enable-nontrapping-float-to-int --enable-reference-types --enable-sign-ext
[wasm-validator error in function draco::DepthFirstTraverser<draco::MeshAttributeCornerTable\2c\20draco::MeshAttributeIndicesEncodingObserver<draco::MeshAttributeCornerTable>>::TraverseFromCorner\28draco::IndexType<unsigned\20int\2c\20draco::CornerIndex_tag_type_>\29] unexpected false: offset must be u32, on
(i32.load offset=17179869180
(i32.wrap_i64
(local.tee $4
(i64.load offset=56
(i32.wrap_i64
(local.get $4)
)
)
)
)
)
Fatal: error after opts
em++: error: '/Users/dev/.local/share/mise/installs/emsdk/4.0.23/upstream/bin/wasm-opt --memory64-lowering --table64-lowering /var/folders/rx/cml17gjj1yn5zzpf_7sl1l9w0000gn/T/emscripten_temp_8kwnhvhp/tsgen.wasm -o /var/folders/rx/cml17gjj1yn5zzpf_7sl1l9w0000gn/T/emscripten_temp_8kwnhvhp/tsgen.wasm --mvp-features --enable-threads --enable-bulk-memory --enable-bulk-memory-opt --enable-call-indirect-overlong --enable-memory64 --enable-multivalue --enable-mutable-globals --enable-nontrapping-float-to-int --enable-reference-types --enable-sign-ext' failed (returned 1)
ninja: build stopped: subcommand failed.
Metadata
Metadata
Assignees
Labels
No labels
Activity
kripken commentedon Jan 30, 2026
Looks like you attached
libdraco.a, but the instructions mention other input files, so that's not enough to reproduce.However, I see
Fatal: error after optsso the simplest thing might be for you to compile withEMCC_DEBUG=1and provide the temp wasm files from/tmp/emscripten_temp. That should be enough to reproduce the erroring binaryen command.sorenbg commentedon Feb 5, 2026
Hi @kripken thank you for looking at this. I was out sick, so could not investigate further until today.
I am afraid I cannot share the output files generated with EMCC_DEBUG since it would include proprietary information. I managed to reproduce the error in a self-contained build files.zip. The 'files.zip' contains a CMake project which can be built either with 'run.sh' or as
This triggers the error for me every time. Tested on:
I tried to reduce the compilation settings as far as possible and for some reason, the link option
seems to be needed to reproduce the error. Not sure why this should impact linking/optimization.
Let me know if I can be of further assistance.
kripken commentedon Feb 5, 2026
Ah, this is probably a flag that
--emit-tsdneeds to handle. @brendandahl ?brendandahl commentedon Feb 18, 2026
This should be resolved with the latest emscripten. If you're using emsdk use
./emsdk install totto try it out.sorenbg commentedon Feb 20, 2026
Confirmed, everything appears to work as it should.
Thank you for the quick response!