Stream: wasm

Topic: ✔ panic=unwind with wasm32-wasip2


view this post on Zulip Julien Cretin (ia0) (Jul 25 2025 at 20:27):

I'm trying to run a cargo test with wasmtime to test on a 32-bits platform. (Maybe I should use QEMU.) I'm essentially doing:

RUSTFLAGS='-C panic=unwind' cargo test -Z build-std=std --target=wasm32-wasip2 -- --nocapture

(I have target.wasm32-wasip2.runner = "wasmtime -W exceptions=y" in my .cargo/config.toml but I'm not reaching this stage yet.)
And I get:

error: linking with `wasm-component-ld` failed: exit status: 1
[...]
  = note: error: failed to encode component

          Caused by:
              0: failed to decode world from module
              1: module was not valid
              2: failed to resolve import `env::__cpp_exception`
              3: module is only allowed to import functions

Is there a way to fix/work-around this? Or should I just wait for https://github.com/rust-lang/rust/issues/118168 ?

This is a tracking issue for wasm native exception handling, which would allow panic=unwind to function properly for code targeting wasm. About tracking issues Tracking issues are used to record th...

view this post on Zulip Julien Cretin (ia0) (Jul 25 2025 at 20:41):

Actually it works just fine to run a i686-unknown-linux-gnu binary on a x86_64-unknown-linux-gnu platform. I'll follow the tracking issue because it might be useful for other reasons. I'll mark this issue resolved. (Sorry for the noise.)

view this post on Zulip Notification Bot (Jul 25 2025 at 20:41):

Julien Cretin (ia0) has marked this topic as resolved.


Last updated: Dec 06 2025 at 05:03 UTC