Error in multithreading with wasm-pack and webassembly rust
See original GitHub issueBug report
What is the current behavior?
When compiling https://github.com/iMplode-nZ/rust-webpack-multithreading-test via (p)npm watch
using webpack 5.49.0 and the latest rust and the rust flags -Ctarget-feature=+atomics,+bulk-memory,+mutable-globals
, I get this error:
webpack compiled with 1 error
ERROR in ./pkg/index_bg.wasm
Module parse failed: Unexpected section: 0xc
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
Error: Unexpected section: 0xc
If the current behavior is a bug, please provide the steps to reproduce.
Clone https://github.com/iMplode-nZ/rust-webpack-multithreading-test, npm install
, npm serve
.
What is the expected behavior?
It does not error.
Other relevant information: webpack version: 5.49.0 Node.js version: 14.4.0 Operating System: Ubuntu 20.04 focal Additional tools:
rustc 1.56.0-nightly (4e282795d 2021-07-31)
wasm-bindgen 0.2.75
wasm-pack 0.10.0
I’m putting this here as it seems more like a webpack bug than a wasm-pack/bindgen/rust bug. See wasm-pack issue at https://github.com/rustwasm/wasm-pack/issues/1050
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:12 (4 by maintainers)
Top GitHub Comments
Same issue here
“Unexpected section: 0xc” throws in wasm-async, or more precisely it crashes in @webassemblyjs/wasm-parser. This is a minimal example to reproduce the error:
example files to reproduce: wasm_parse_bug.zip
I compiled the hello world example with wasm-pack:
wasm_parse_bug/hello_wasm_bg_working.wasm: (this works perfectly fine in webpack) compiled with:
wasm-pack build
wasm_parse_bug/hello_wasm_bg_broken.wasm: (this causes the 0xc error) compiled with:
RUSTFLAGS="-C target-feature=+atomics,+bulk-memory,+mutable-globals" wasm-pack build
Issue was closed because of inactivity.
If you think this is still a valid issue, please file a new issue with additional information.