Unexpected wasm-opt crash when running wasm-pack

I just got an unexpected failure that smells like a tool-chain issue. The error message seems to include a text dump of an entire wasm-compiled binary, so it's gigantic, and I'm not sure what is most relevant.

The command that fails is

wasm-pack build --target web

and the error looks like:

e[1me[2m[INFO]e[0m: Installing wasm-bindgen...
e[1me[2m[INFO]e[0m: Optimizing wasm binaries with `wasm-opt`...
[wasm-validator error in module] unexpected true: Exported global cannot be mutable, on 
global$0
(module
 (type $i32_i32_=>_none (func (param i32 i32)))
 (type $i32_=>_none (func (param i32)))
 (type $i32_i32_i32_=>_none (func (param i32 i32 i32)))

https://travis-ci.org/github/droundy/paradigms/jobs/712739691

(text file at https://api.travis-ci.org/v3/job/712739691/log.txt)

Is anyone else seeing something like this, or does anyone have an explanation?

1 Like

I've identified that the error comes from wasm-opt and I can disable running wasm-opt in my Cargo.toml, so the emergency is reduced and it looks like the bug is not in the rust tool chain itself.

Thanks for the quick fix! I added the following code to my cargo.toml for those that are curious.

[package.metadata.wasm-pack.profile.release]
wasm-opt = false

Had you encountered this also, then?

Yes and sorry for being brief earlier.

This looks like an open issue out on wasm-pack. Perhaps, specifying the version suggested in the issue for your build script will fix the issue

I'm aware of that issue, thanks! For now I'll just stick with disabling wasm-opt until the issue is fixed.