Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Web] Fix thread+dlink builds with emscripten 3.1.61+git #93143

Merged
merged 4 commits into from
Jun 14, 2024

Conversation

Faless
Copy link
Collaborator

@Faless Faless commented Jun 13, 2024

This PR does few things to restore and improve thread+dlink web builds:

  • Refactor the emscripten's -s OPTION=value to -sOPTION=value to get rid of a nasty warning (I can split this in a separate PR if you prefer, since it adds a bit of noise)
  • Force the SUPPORT_LONGJMP option to 'wasm' to improve gdextension interop (see emscripten 3.1.32 changelog). I'll open a godot-cpp PR to add the same flags (godot-cpp counterpart [Web] Force emcc to use "wasm" longjmp mode godot-cpp#1489).
  • Disable thorvg threading on the web (this is of little use, and threads are a scarce resource so it increases the chance of deadlock).
  • Use emscripten dynamicLibraries option to preload GDExtensions instead of manually calling loadDynamicLibrary which seems to avoid a deadlock on firefox (see https://bugzilla.mozilla.org/show_bug.cgi?id=1897427 ).

Note, emscripten 3.1.62 is unreleased, I've taken 3.1.61 and applied emscripten-core/emscripten#19496

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me!

Copy link
Member

@adamscott adamscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine with the small change I proposed! Thanks Fabio!

Faless added 4 commits June 14, 2024 16:03
SUPPORT_LONGJMP have changed since emscripten 3.1.32 to default to
"wasm" mode when exceptions are enabled, and "emscripten" mode when
disabled.

While we generally doesn't use exception in core, linked libraries may
need them, and emscripten don't plan to support WASM EH + Emscripten
SjLj in the long term.
They're of little help, and just adds to the possibility of causing
deadlocks.
Instead of calling loadDynamicLibraries ourselves, we add the
GDExtension libraries to preload to the "dynamicLibraries" module config
property.

This seems to fix some threading issue with some browsers during the
init phase.
@Faless Faless force-pushed the web/fix_dlink_emcc_3.1.62 branch from 6893ac1 to 27d67b5 Compare June 14, 2024 14:04
@akien-mga akien-mga merged commit 71699e0 into godotengine:master Jun 14, 2024
16 checks passed
@Faless Faless deleted the web/fix_dlink_emcc_3.1.62 branch June 14, 2024 15:18
@akien-mga
Copy link
Member

akien-mga commented Jun 14, 2024

Thanks! Awesome work 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants