Skip to content

Commit

Permalink
[Web] Add workaround for missing export in threaded builds
Browse files Browse the repository at this point in the history
The offending symbol gets stripped away by wasm-dce but it's used on the
JavaScript side and causes and undefined symbol which also causes the
closure compiler to throw an error.
  • Loading branch information
Faless committed Jul 26, 2024
1 parent 91eb688 commit 26f17c3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions platform/web/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ def configure(env: "SConsEnvironment"):
env.Append(LINKFLAGS=["-sDEFAULT_PTHREAD_STACK_SIZE=%sKB" % env["default_pthread_stack_size"]])
env.Append(LINKFLAGS=["-sPTHREAD_POOL_SIZE=8"])
env.Append(LINKFLAGS=["-sWASM_MEM_MAX=2048MB"])
if not env["dlink_enabled"]:
# Workaround https://github.com/emscripten-core/emscripten/issues/21844#issuecomment-2116936414.
# Not needed (and potentially dangerous) when dlink_enabled=yes, since we set EXPORT_ALL=1 in that case.
env.Append(LINKFLAGS=["-sEXPORTED_FUNCTIONS=['__emscripten_thread_crashed','_main']"])

elif env["proxy_to_pthread"]:
print_warning('"threads=no" support requires "proxy_to_pthread=no", disabling proxy to pthread.')
env["proxy_to_pthread"] = False
Expand Down

0 comments on commit 26f17c3

Please sign in to comment.