Wasm-pack: wasm-opt exits with signal 6

Created on 2 Feb 2020  路  12Comments  路  Source: rustwasm/wasm-pack

Related: #696

馃悰 Bug description

Running wasm-pack build in in a Github action after running the installer fails

Error: failed to execute `wasm-opt`: exited with signal: 6
  full command: "/home/runner/.cache/.wasm-pack/wasm-opt-37dc6b0d9960f622/wasm-opt" "/home/runner/work/crdocs/crdocs/frontend/pkg/crdocs_bg.wasm" "-o" "/home/runner/work/crdocs/crdocs/frontend/pkg/crdocs_bg.wasm-opt.wasm" "-O"
To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.

To see a failed build: https://github.com/xldenis/crdocs/runs/421370544?check_suite_focus=true

馃 Expected Behavior

wasm-opt should run successfully.

馃憻 Steps to reproduce

Rerunning CI on that specific commit should cause a failure reliably.

馃實 Your environment

Include the relevant details of your environment.
wasm-pack version: 0.9.0

bug

Most helpful comment

i'm going to cut a point release today that ups the version of wasm-opt! i'll mention on this issue as soon as i do

All 12 comments

I have experienced the same error signal, but locally on linux (Ubuntu 19.04). It seems to be triggering _randomly_ during builds (i.e clean builds can succeed or fail).

I suspect this to be related to cargo workspaces, as my setup use this feature as well (orchestrated by cargo-make).

Edit:
Currently trying to produce a minimal example, but it is proving difficult :disappointed:

I just ran into the same problem. Turns out all I needed to do was install wasm-opt using npm install wasm-opt -g

Source: https://github.com/MrRefactoring/wasm-opt

We are experiencing the same issue for at least 3 days on both Ubuntu and CircleCI with Rust Docker image 馃槥

really sorry that folks are running into this- i'll look into it today! if you want- you can pin wasm-pack at 0.8.1 by using the npm installer.

alternatively, you can disable wasm-opt temporarily by setting wasm-opt = false in your cargo.toml, while i figure out what's happening

I can reproduce this and #781 in Ubuntu 18.04 (running in Windows Subsystem for Linux):

Error: failed to execute `wasm-opt`: exited with signal: 6
  full command: "/home/justin/.cache/.wasm-pack/wasm-opt-37dc6b0d9960f622/wasm-opt" "lib/pkg/landlord_bg.wasm" "-o" "lib/pkg/landlord_bg.wasm-opt.wasm" "-O"

Running the same command manually without the the -O flag seems to resolve both this issue and #781 and the program successfully completes and writes out lib/pkg/landlord_bg.wasm-opt.wasm.

I just changed my installation command in CI to cargo install wasm-pack --version 0.8.1 since I didn't want to also install npm.

I'm also encountering this on my Ubuntu 19.10 machine. The segmentation fault happens every time using the wasm-opt that comes with wasm-pack.


Version Numbers and Environment

$ rustc --version --verbose
rustc 1.42.0-nightly (cd1ef390e 2020-01-31)
binary: rustc
commit-hash: cd1ef390e731ed77b90b11b1f77e2c5ca641b261
commit-date: 2020-01-31
host: x86_64-unknown-linux-gnu
release: 1.42.0-nightly
LLVM version: 9.0
$ cargo --version --verbose
cargo 1.42.0-nightly (9d32b7b01 2020-01-26)
release: 1.42.0
commit-hash: 9d32b7b01409024b165545c568b1525d86e2b7cb
commit-date: 2020-01-26
$ wasm-pack --version
wasm-pack 0.9.0

It looks like wasm-opt doesn't have a --version flag, so I'm not sure which version is on my machine.

I tried getting a backtrace using gdb but the binary is stripped and statically linked, so the backtrace was kinda useless.

I also tried compiling wasm-opt from source with optimisations and debug info, but it didn't want to segfault :disappointed:


Installing from source

$ cd /tmp
$ git clone [email protected]:WebAssembly/binaryen.git
$ git rev-parse HEAD
33f92aa06fe5de7bcf9f6b7fe2e74ba5e8e1e782
$ mkdir build && cd build
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
$ ninja
$ ls bin
asm2wasm  wasm-as  wasm-ctor-eval  wasm-dis  wasm-emscripten-finalize  wasm-metadce  wasm-opt  wasm-reduce  wasm-shell  wasm2js
$ cd ~/Documents/arcs
$ /tmp/binaryen/build/bin/wasm-opt demo/pkg/arcs_demo_bg.wasm -o demo/pkg/arcs_demo_bg.wasm-opt.wasm -O
$ echo $?
0

I'm going to keep using this binary locally for now. If it segfaults again I'll update this comment with a backtrace and more info.

Turns out all I needed to do was install wasm-opt using npm install wasm-opt -g

I can confirm that it did help me too (Ubuntu at CircleCI, wasm-pack 0.9.0, rust 1.41.0)

Using wasm-opt 90 instead of 78 fixed this issue for me (Ubuntu 19.04). Changed version here.

i'm going to cut a point release today that ups the version of wasm-opt! i'll mention on this issue as soon as i do

thanks for the prompt response!

Thanks for fixing the issue guys 鉂わ笍

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ashleygwilliams picture ashleygwilliams  路  3Comments

TorstenStueber picture TorstenStueber  路  3Comments

turboladen picture turboladen  路  4Comments

rbtcollins picture rbtcollins  路  3Comments

mikedilger picture mikedilger  路  3Comments