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

Debug builds don't work on web #1021

Open
necrashter opened this issue Jan 31, 2023 · 1 comment
Open

Debug builds don't work on web #1021

necrashter opened this issue Jan 31, 2023 · 1 comment
Labels

Comments

@necrashter
Copy link

Exporting the Hello World project to Web with debug mode causes the game to crash on start-up with the following error on Firefox:

wasm validation error: at offset 838450: too many locals

And with the following on Brave browser:

WebAssembly.instantiate(): Compiling function #2262:"gdnative_sys::GodotApi::from_raw::h2b788ea99960..." failed: local count too large @+838449

Presumably, this happens due to library size. .wasm file size is 280 kB on release, 21.8 MB on debug. For reference, godot.side.wasm is 19.2 MB in 3.5.1 and 14.8 MB in my custom build.

Using the master version of this repository (commit 91e1b77) with Godot 3.x branch (commit 9b0f0a713695fe074afe75ed968aafb046efefe8).

I discovered this bug while trying to compile and run GDNative with threads on web. But the issue remains even if you compile the Hello world project as explained in the book. Original discussion took place in "GDNative Threads on Web" thread on Discord server.

Somewhat related: #305

@necrashter necrashter added the bug label Jan 31, 2023
@necrashter
Copy link
Author

Workaround: As @chitoyuu recommended on Discord, adding this setting to project's Cargo.toml reduces the .wasm binary size to 13.8 MB, which allows the game to run on both browsers:

[profile.dev]
opt-level = 1

If you have a workspace, you need to add this to workspace's Cargo.toml. Otherwise it will be ignored.

This also confirms that it's caused by large .wasm binary size.

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

No branches or pull requests

1 participant