Stream: general

Topic: excluding WASI interfaces from a module


view this post on Zulip Evan (May 24 2026 at 05:46):

Hi, I'm building a little prototype wasm function runtime for a blog post, and I tried to use the component model (to force users to satisfy interface requirements) and I had an issue and a question.

The issue: I wired everything up statically, but I can't get my component to run, because all the wasi interfaces are required. e.g.:

Error: component imports instance `wasi:io/poll@0.2.6`, but a matching implementation was not found in the linker

I don't really want these for components, and I didn't explicitly include them, but they got included anyway. Is there a way to disable this?

The question is whether it's possible to mark component interfaces as optional? I don't think that I actually need this for this project, but it'd be nice to be able to have optional interfaces for components.

view this post on Zulip Christof Petig (May 24 2026 at 07:15):

I think experimenting with the wasm32-unknown-unknown target will get you there today, while long term this is what wasm32-component is for: https://rust-lang.github.io/rust-project-goals/2026/wasm-components.html

WASI is used by your language's standard library.

view this post on Zulip Evan (May 24 2026 at 16:00):

That makes sense, I hadn't thought of that. Gives me some experiments to do, at least.

I wasn't able to make wasm32-unknown-unknown work: attempted to parse a wasm module with a component parser, but maybe I can stop using components and do some dynamic checking at module load/link time to enforce the various API constraints?

view this post on Zulip Victor Adossi (May 25 2026 at 23:38):

Hey @Evan how are you building the components? What language?

Depending on the language toolchain/project you're using to build, the way to build components without those requirements is different.

For example like Christof said, if you're in Rust, the language stdlib (and panic/unwind machinery) will use P2 by default so you have to remove it if you don't want to any of that:

https://bytecodealliance.zulipchat.com/#narrow/channel/217126-wasmtime/topic/wasi.20pulled.20in.20unintentionally/near/490095340

cargo component is no longer the recommended way to build rust components (you can use plain cargo instead), but the cargo build mentioned in the last comment in that thread is probably close to what you want, though it's for wasm32-wasip1, it should be relatively close to that for p2.

view this post on Zulip Victor Adossi (May 26 2026 at 00:01):

Here's an example repo that should be easy to follow/dissect:

https://github.com/vados-cosmonic/example-rust-component-p2-no-wasi-imports

view this post on Zulip Evan (May 26 2026 at 01:46):

Thanks Victor! I haven't had any time to look at it this weekend, but a quick glance at this seems very promising. I will update the thread with my progress sometime in the coming week.


Last updated: Jun 01 2026 at 09:49 UTC