Stream: general

Topic: ✔ cargo component targeting wasm32-unknown-unknown?


view this post on Zulip Christoph Brewing (Nov 15 2023 at 12:08):

It is said that "Currently cargo component targets wasm32-wasi by default.".

My question is: (how) can I switch to wasm32-unknown-unknown?

Rationale: My library does not need all the wasi specific imports, i.e. when I python -m wasmtime.bindgen ./component.wasm --out-dir decoder/ for getting Python bindings, I get all the (unneeded) imports. I would like to get rid of them. What is the best way to do so?

A Cargo subcommand for creating WebAssembly components based on the component model proposal. - GitHub - bytecodealliance/cargo-component: A Cargo subcommand for creating WebAssembly components bas...

view this post on Zulip bjorn3 (Nov 15 2023 at 12:19):

wasm32-unknown-unknown is currently ABI incompatible with both clang (all wasm targets) and rustc (wasm32-wasi and wasm32-unknown-emscripten).

view this post on Zulip Christoph Brewing (Nov 15 2023 at 12:46):

Thank you for this clarification.

view this post on Zulip Peter Huene (Nov 15 2023 at 16:24):

That said, adding --target wasm32-unknown-unknown to your cargo component build invocation will still produce a component, just not with wasi imports

view this post on Zulip Notification Bot (Nov 16 2023 at 10:11):

Christoph Brewing has marked this topic as resolved.


Last updated: Dec 23 2024 at 12:05 UTC