trunk: Build failure with Rust 1.82.0 and bundled wasm-opt
After upgrading from Rust 1.81 to 1.82 I discovered that a particular wasm/trunk project no longer builds. It always fails with:
[parse exception: invalid code after misc prefix: 17 (at 0:20646)]
Fatal: error parsing wasm (try --debug for more info)
2024-11-04T23:06:47.941140Z ERROR ❌ error
error from build pipeline
Caused by:
0: HTML build pipeline failed (1 errors), showing first
1: error from asset pipeline
2: running wasm-opt
3: wasm-opt call to executable '/home/___/.cache/trunk/wasm-opt-version_116/bin/wasm-opt' with args: '["--output=.../wasm_test_2024_b/target/wasm-opt/release/wasm_test_2024_bg.wasm", "-Oz", ".../wasm_test_2024_b/dist/.stage/wasm_test_2024-616af1a08af380ae_bg.wasm"]' returned a bad status: exit status: 1
2024-11-04T23:06:47.941182Z ERROR error from build pipeline
2024-11-04T23:06:47.941184Z INFO 1: HTML build pipeline failed (1 errors), showing first
2024-11-04T23:06:47.941186Z INFO 2: error from asset pipeline
2024-11-04T23:06:47.941187Z INFO 3: running wasm-opt
2024-11-04T23:06:47.941189Z INFO 4: wasm-opt call to executable '/home/___/.cache/trunk/wasm-opt-version_116/bin/wasm-opt' with args: '["--output=.../wasm_test_2024_b/target/wasm-opt/release/wasm_test_2024_bg.wasm", "-Oz", ".../wasm_test_2024_b/dist/.stage/wasm_test_2024-616af1a08af380ae_bg.wasm"]' returned a bad status: exit status: 1
I built a minimized project that demonstrates the issue here: https://github.com/eric-seppanen/wasm_test_2024
This seems to be a wasm-opt issue, but since wasm-opt is bundled with trunk by default, perhaps it would be a good idea to ship a newer version?
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 6
- Comments: 24 (2 by maintainers)
Commits related to this issue
- Fix build bug caused by wasm-bindgen https://github.com/trunk-rs/trunk/issues/904 — committed to Thadah/v_vmifier by Thadah 2 years ago
@troelsfr the wasm-opt version is configurable already through Trunk.toml https://github.com/trunk-rs/trunk/blob/4c9d85f6f04a31a272c71db8df12e142c76311fb/Trunk.toml
I’m using:
and this on my html:
If wasm-opt is going to be full of usability paper cuts, I wonder if trunk should just disable it by default.
It seems like a bad tradeoff to force people to debug a wasm code optimizer before they ever get their first project working.
Yeah, looks like LLVM20 turned on bulk memory instructions: https://github.com/rust-lang/rust/issues/137315
I investigated a few versions of
wasm-optand found that any version >= 117 works, but they all require an additional CLI flag--enable-bulk-memory.I’m not sure how to make this happen when using trunk.
So perhaps this is related to #866?