summaryrefslogtreecommitdiffstats
path: root/platform
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2024-07-24 19:56:48 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2024-07-26 12:28:36 +0200
commit26f17c33a503a09966c770d9b69a96e1f3914ea6 (patch)
tree72c13ca9dac531b4de355544de03e0c80b6ed83c /platform
parent91eb688e178fe32f28aebfbec01137abefd75413 (diff)
downloadredot-engine-26f17c33a503a09966c770d9b69a96e1f3914ea6.tar.gz
[Web] Add workaround for missing export in threaded builds
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.
Diffstat (limited to 'platform')
-rw-r--r--platform/web/detect.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/platform/web/detect.py b/platform/web/detect.py
index 79485ea28a..bf75c2f9fc 100644
--- a/platform/web/detect.py
+++ b/platform/web/detect.py
@@ -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