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

wasm-opt exits with signal 6 #782

Closed
xldenis opened this issue Feb 2, 2020 · 12 comments · Fixed by #687
Closed

wasm-opt exits with signal 6 #782

xldenis opened this issue Feb 2, 2020 · 12 comments · Fixed by #687
Assignees
Labels
bug Something isn't working
Milestone

Comments

@xldenis
Copy link

xldenis commented Feb 2, 2020

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

@tobni
Copy link

tobni commented Feb 2, 2020

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 😞

@BradyKoehler
Copy link

BradyKoehler commented Feb 3, 2020

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

@evaporei
Copy link

evaporei commented Feb 3, 2020

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

@ashleygwilliams ashleygwilliams added the bug Something isn't working label Feb 3, 2020
@ashleygwilliams ashleygwilliams self-assigned this Feb 3, 2020
@ashleygwilliams
Copy link
Member

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

@jshrake
Copy link

jshrake commented Feb 3, 2020

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.

@xldenis
Copy link
Author

xldenis commented Feb 4, 2020

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.

@Michael-F-Bryan
Copy link

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 😞

Installing from source
$ cd /tmp
$ git clone git@github.com: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.

@artemv
Copy link

artemv commented Feb 5, 2020

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)

kurbaniec added a commit to U3W/EasyPass that referenced this issue Feb 5, 2020
When building WebAssembly, the invoked wasm-opt command returns a error.

To fix this, the current workaround mentioned in the issue rustwasm/wasm-pack#782 is to install wasm-opt manually with npm again.
@alexlapa
Copy link

alexlapa commented Feb 6, 2020

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

@ashleygwilliams
Copy link
Member

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

@xldenis
Copy link
Author

xldenis commented Feb 8, 2020

thanks for the prompt response!

@evaporei
Copy link

Thanks for fixing the issue guys ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants