wasm-bindgen icon indicating copy to clipboard operation
wasm-bindgen copied to clipboard

wasm-bindgen's CLI panics with `_ZN4FMOD16RuntimeBankModelC2Ev: non-i32 constant`

Open melody-rs opened this issue 7 months ago • 0 comments

Describe the Bug

wasm-bindgen's interpreter chokes on emscripten compiled code. I'm running into this specifically when trying to use FMOD's HTML5 build and using the currently unstable -Zwasm-c-abi=spec flag

[2025-04-28T06:26:40Z DEBUG wasm_bindgen_wasm_interpreter] arguments []
[2025-04-28T06:26:40Z DEBUG wasm_bindgen_wasm_interpreter] starting a call of Id { idx: 26 } Some("__wasm_call_ctors")
[2025-04-28T06:26:40Z DEBUG wasm_bindgen_wasm_interpreter] arguments []
[2025-04-28T06:26:40Z DEBUG wasm_bindgen_wasm_interpreter] starting a call of Id { idx: 1511 } Some("_GLOBAL__sub_I_fmod_bankmodel.cpp")
[2025-04-28T06:26:40Z DEBUG wasm_bindgen_wasm_interpreter] arguments []
[2025-04-28T06:26:40Z DEBUG wasm_bindgen_wasm_interpreter] starting a call of Id { idx: 1399 } Some("_ZN4FMOD16RuntimeBankModelC2Ev")
[2025-04-28T06:26:40Z DEBUG wasm_bindgen_wasm_interpreter] arguments [32768]

thread 'main' panicked at crates/wasm-interpreter/src/lib.rs:245:21:
_ZN4FMOD16RuntimeBankModelC2Ev: non-i32 constant

I'm suspicious of that argument count- [32768] looks to me like a magic value for vaargs

Steps to Reproduce

  1. Clone https://github.com/melody-rs/fmod-oxide
  2. Download FMOD's HTML5 build, and place it in fmod-sys/fmod (fmod-oxide's README goes into more detail)
  3. Run RUSTFLAGS="-Zwasm-c-abi=spec" cargo build -p wasm-unknown --target wasm32-unknown-unknown
  4. Run RUST_LOG=debug wasm-bindgen target/wasm32-unknown-unknown/debug/wasm_unknown.wasm --out-dir out

Additional Context

https://github.com/melody-rs/fmod-oxide/issues/7

melody-rs avatar Apr 28 '25 06:04 melody-rs