rustwasm / book

The Rust and WebAssembly Book
https://rustwasm.github.io/docs/book/
MIT License
1.75k stars 211 forks source link

wasm-pack build fails for Game of Life tutorial due to known issue #237

Open huppmann opened 4 years ago

huppmann commented 4 years ago

wasm-pack's optimizer fails because of the export of a mutable global:

[INFO]: Optimizing wasm binaries with `wasm-opt`...
[wasm-validator error in module] unexpected true: Exported global cannot be mutable, on 
global$0

The issue is reported here.

I worked around by following the suggestion to add

[package.metadata.wasm-pack.profile.release]
wasm-opt = ["-Oz", "--enable-mutable-globals"]

to Cargo.toml.

Don't know if this is a gotcha you'd want to point out in the tutorial. (I ran into it here.). Otherwise, presume you can close and a web search will maybe land people here.

clemens-tolboom commented 4 years ago

Please don't shorten your links

Longer give more context :-)