Stream: wasi

Topic: Runtime linking issues with wasip3 and nightly reactor


view this post on Zulip mainrs (Jun 05 2025 at 08:08):

I have a WASI library that uses wasi-http@0.3.0-draft. I generated the wit bindings myself with async support. Compilation is done using cargo build --manifest-path wasm/Cargo.toml --target wasm32-wasip1 --release, followed by wasm-tools component new target/wasm32-wasip1/release/library.wasm --adapt wasi_snapshot_preview1.reactor.wasm --skip-validation -o component.wasm. As far as I understood, this should lift my component into p3.

I use the wasip3-prototyping wasmtime implementation and its other crates. The WASM binary loading works and I don't get any parsing errors (which should mean that all tools used in the process generate the same async ABI).

The issue I am facing now is that the reactor adapter uses wasi:cli/environment@0.2.3. But the linker only knows about 0.3.0, since that's what gets added by wasmtime-wasi.

These are my pinned dependency versions:

wasmtime = { git = "https://github.com/bytecodealliance/wasip3-prototyping", rev = "a759b5c37fdd3a7b5110a33fa24b624c2baee5d4", features = [
    "component-model-async",
] }
wasmtime-wasi = { git = "https://github.com/bytecodealliance/wasip3-prototyping", rev = "a759b5c37fdd3a7b5110a33fa24b624c2baee5d4" }
wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "80cf018de24a45210c9ffe15d944f4485a0457fc" }
# wasm-tools = { git = "https://github.com/bytecodealliance/wasm-tools", rev = "150a220ec5a586433c8a83cf81915dc767a376d9" }
# wasi_snapshot_preview1.reactor.wasm: https://github.com/bytecodealliance/wasip3-prototyping/releases/download/dev/wasi_snapshot_preview1.reactor.wasm

Some debugging output I did:

$ wasm-objdump -x wasi_snapshot_preview1.reactor.wasm | grep env
 - memory[0] pages: initial=0 <- env.memory
 - func[0] sig=0 <_ZN22wasi_snapshot_preview122wasi_cli_get_arguments17h65f3069d0d182bd1E> <- wasi:cli/environment@0.2.3.get-arguments
 - func[1] sig=0 <_ZN22wasi_snapshot_preview124wasi_cli_get_environment17h16221c78d8ae41fdE> <- wasi:cli/environment@0.2.3.get-environment
 - func[78] sig=20 <environ_get>
 - func[79] sig=20 <environ_sizes_get>
 - func[78] <environ_get> -> "environ_get"
 - func[79] <environ_sizes_get> -> "environ_sizes_get"
 - func[78] size=409 <environ_get>
 - func[79] size=387 <environ_sizes_get>
 - func[1] <_ZN22wasi_snapshot_preview124wasi_cli_get_environment17h16221c78d8ae41fdE>
 - func[78] <environ_get>
 - func[79] <environ_sizes_get>
$ cargo run -p ugl-wasmtime
[...]

thread 'main' panicked at ugl-wasmtime/src/main.rs:2:25:
called `Result::unwrap()` on an `Err` value: component imports instance `wasi:cli/environment@0.2.3`, but a matching implementation was not found in the linker

Caused by:
    0: instance export `get-environment` has the wrong type
    1: function implementation is missing
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

These are the components of my async wasm library:

# deps.toml
[http]
url = "https://github.com/WebAssembly/wasi-http/archive/d163277b8684483a2334363ca1492ca298ea526d.tar.gz"
subdir = "wit-0.3.0-draft"

# world.wit
package ugl:wasi-http;

world bindings {
    include wasi:http/proxy@0.3.0-draft;
}
pub(crate) mod bindings {
    wit_bindgen::generate!({
        path: "wit",
        world: "bindings",
        async: true,
        generate_all,
    });
}

It looks like the reactor does not use the p3 bindings, and thus fails. Is this to be expected? Am I doing something wrong? If more information is needed, please let me know.

Thanks for your help!


Last updated: Dec 06 2025 at 06:05 UTC