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

Add WASM_BIGINT linker flag to the web build #88594

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

adamscott
Copy link
Member

Adds the WASM_BIGINT linker flag to the web build in order to fix issues with i64 values. This fix is needed to call Javascript from Godot since emscripten version 3.1.41.

Fixes #88249

@adamscott adamscott added this to the 4.3 milestone Feb 20, 2024
@adamscott adamscott requested a review from a team as a code owner February 20, 2024 13:23
@adamscott adamscott added cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release labels Feb 20, 2024
@akien-mga akien-mga added cherrypick:3.x Considered for cherry-picking into a future 3.x release cherrypick:3.5 Considered for cherry-picking into a future 3.5.x release labels Feb 20, 2024
@akien-mga akien-mga merged commit f55ee87 into godotengine:master Feb 20, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@flashag
Copy link

flashag commented Feb 28, 2024

Hi! Sorry for invasion but can someone help me to implement this fix? I use 4.3 dev3 version and I have the same issue when I try to run a game on CrazyGames. Is there a build with the fix or how can I modify my local version of Godot 4.3 dev3? Will be very grateful for just pointing me out 🙏

@akien-mga
Copy link
Member

@flashag You will need to build your own export templates with the changes from this PR, or with Emscripten < 3.1.41.
Or you can use 4.3-dev2 to export your game if you don't need anything specifically added in dev3. Or wait for 4.3-dev4 which should be published in coming days.

github-actions bot pushed a commit to luismedel/st-puzzles-macos that referenced this pull request Mar 1, 2024
I updated Emscripten recently, to version 3.1.54. The result was that
none of the WASM puzzles run any more, because they produce a stack
trace at startup with the error message "to do setValue(i64) use
WASM_BIGINT".

I don't fully understand this. The stack trace comes via a JS wrapper
around a WASM-compiled function called __main_argc_argv, which sounds
like something in the Emscripten library startup. Somewhere in there
it goes via _js_get_date_64(), which tries to write an i64 into the
WASM memory array, which hits this abort in setValue().

Web searching for the error message turned up
godotengine/godot#88594 which gave me the clue
that '-s WASM_BIGINT' is a command-line setting for the Emscripten
linker. And indeed, setting that makes the startup-time error go away
and the puzzles run again. But it also causes older versions of all
browsers to be unsupported, presumably on the grounds that they don't
have whatever WASM bigint feature this flag causes the code to use.

I don't really understand what's going on here. I assume
_js_get_date_64 is being called to handle a 64-bit time_t. But the
Puzzles code doesn't work with time_t at all, so this is entirely in
the Emscripten standard library. And if the pre-main() startup code
needs a 64-bit integer write, which won't work without this flag, then
surely _nothing_ would work without this flag, and surely someone
would have noticed that, and made that flag the default? This all
seems confusing and I wonder if I've misunderstood something.

However, if I don't fix it in _some_ way, the web puzzles will stay
out of action for days and I'll get lots of email complaints. So
here's something that makes them basically work again, and maybe we
can figure out the rest of the story later.
@akien-mga
Copy link
Member

Cherry-picked for 4.2.2.
Cherry-picked for 4.1.4.

@akien-mga akien-mga removed cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release labels Mar 11, 2024
@akien-mga
Copy link
Member

Cherry-picked for 3.6.
Cherry-picked for 3.5.4.

@akien-mga akien-mga removed cherrypick:3.x Considered for cherry-picking into a future 3.x release cherrypick:3.5 Considered for cherry-picking into a future 3.5.x release labels Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants