Stream: general

Topic: ✔ Rust generating broken .wasm files with target wasm32-wasi


view this post on Zulip Bernard Kolobara (Aug 26 2021 at 12:53):

I'm running a WebAssembly application on the backend through [wasmtime], but as soon as I include tungstenite as a dependency the generated .wasm file becomes invalid (has 2 random_get definitions):

Error: failed to parse WebAssembly module

Caused by:
    Invalid input WebAssembly code at offset 682: duplicate import name `wasi_snapshot_preview1::random_get` already defined

Both definitions point to the same signature and I'm not sure why this doesn't get de-duplicated by the Rust compiler.

view this post on Zulip Bernard Kolobara (Aug 26 2021 at 12:54):

Does anyone have an idea why this may be happening?

view this post on Zulip Bernard Kolobara (Aug 26 2021 at 13:29):

It looks like it works fine with the nightly compiler.

view this post on Zulip Alex Crichton (Aug 26 2021 at 14:30):

@Bernard Kolobara do you have the module-linking proposal enabled? That should be a valid wasm file but it becomes invalid with module linking

view this post on Zulip Bernard Kolobara (Aug 26 2021 at 14:39):

Yes, I had module-linking enabled. I just assumed that duplicate imports were always invalid. Thanks for the clarification!

view this post on Zulip Notification Bot (Aug 26 2021 at 14:48):

Bernard Kolobara has marked this topic as resolved.


Last updated: Nov 22 2024 at 16:03 UTC