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 fail with [parse exception: invalid code after misc prefix: 17 (at 0:61491)] #1441

Open
Wayonb opened this issue Oct 30, 2024 · 3 comments

Comments

@Wayonb
Copy link

Wayonb commented Oct 30, 2024

🐛 Bug description

Our build was working up to rust 1.81.0.
With Rustc 1.82.0, I am getting an error with wasm-opt.

🤔 Expected Behavior

wasm-opt should work with rustc 1.82.0

👟 Steps to reproduce

 wasm-pack build --release --no-typescript --target nodejs --out-dir ../_build/wasm/node
[INFO]: Checking for the Wasm target...
info: downloading component 'rust-std' for 'wasm32-unknown-unknown'
info: installing component 'rust-std' for 'wasm32-unknown-unknown'
 18.7 MiB /  18.7 MiB (100 %)  13.8 MiB/s in  1s ETA:  0s
[INFO]: Compiling to Wasm...
    Finished `release` profile [optimized] target(s) in 0.08s
[INFO]: Installing wasm-bindgen...
[INFO]: found wasm-opt at "/usr/bin/wasm-opt"
[INFO]: Optimizing wasm binaries with `wasm-opt`...
[parse exception: invalid code after misc prefix: 17 (at 0:61491)]
Fatal: error parsing wasm
Error: failed to execute `wasm-opt`: exited with exit status: 1
  full command: "/usr/bin/wasm-opt" "/home/ubuntu/symbol/sdk/javascript/_build/wasm/node/symbol_crypto_wasm_bg.wasm" "-o" "/home/ubuntu/symbol/sdk/javascript/_build/wasm/node/symbol_crypto_wasm_bg.wasm-opt.wasm" "-O"
To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.
Caused by: failed to execute `wasm-opt`: exited with exit status: 1
  full command: "/usr/bin/wasm-opt" "/home/ubuntu/symbol/sdk/javascript/_build/wasm/node/symbol_crypto_wasm_bg.wasm" "-o" "/home/ubuntu/symbol/sdk/javascript/_build/wasm/node/symbol_crypto_wasm_bg.wasm-opt.wasm" "-O"
To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.

🌍 Your environment

Include the relevant details of your environment.
Ubuntu 24.04(it works on MacOs)
wasm-pack version:
wasm-pack -V
wasm-pack 0.13.1

rustc version:
rustc -V
rustc 1.82.0 (f6e511eec 2024-10-15)

@Wayonb
Copy link
Author

Wayonb commented Oct 30, 2024

@Wayonb Wayonb changed the title was-opt fail with [parse exception: invalid code after misc prefix: 17 (at 0:61491)] wasm-opt fail with [parse exception: invalid code after misc prefix: 17 (at 0:61491)] Oct 30, 2024
@jellybobbin
Copy link

have the same problem

@eric-seppanen
Copy link

When wasm-bindgen 0.2.94-95 sees the wasm target-features metadata emitted by rustc 1.82.0, it enables additional webassembly features on its output (bulk memory instructions) that can cause issues with downstream tools like wasm-opt. This will be fixed in the next release of wasm-bindgen. Until then, workarounds include adding --enable-bulk-memory to the wasm-opt commandline (if your runtime is compatible with bulk-memory instructions), not using wasm-opt at all, or downgrading to rust 1.81 or to wasm-bindgen 0.2.93.

Related discussions:
rustwasm/wasm-bindgen#4250
rustwasm/wasm-bindgen#4211
rust-lang/rust#132620
trunk-rs/trunk#904

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

No branches or pull requests

3 participants