Stream: git-wasmtime

Topic: wasmtime / issue #8521 `Err` value: unknown import: `wasi...


view this post on Zulip Wasmtime GitHub notifications bot (May 01 2024 at 18:58):

maxwellflitton opened issue #8521:

There's been some changes in the API, however, I'm getting the same error. My Cargo.toml has the following:

wasm-bindgen = { version = "0.2", features = ["serde-serialize"] }
wasm-bindgen-futures = "0.4.42"
bincode = "1.3.3"
tokio = { version = "1.0", features = ["full"] }
wasmtime = { version = "20.0.0", features = ["runtime", "async"] }
wasmtime-wasi = { version = "20.0.0", features = ["preview1"] }

And my code consists of the following:

use wasmtime::*;
use wasmtime_wasi::WasiCtxBuilder;
use wasmtime_wasi::preview1::wasi_snapshot_preview1::add_to_linker;

#[tokio::main]
async fn main() {
    let mut config = Config::new();
    config.async_support(true);
    let engine = Engine::new(&config).unwrap();

    let mut linker = Linker::new(&engine);

    let wasi = WasiCtxBuilder::new()
        .inherit_stdio()
        .inherit_args()
        .build_p1();
    let mut store = Store::new(&engine, wasi);

    add_to_linker(&mut linker, |s| s).unwrap();

    let module = Module::from_file(&engine, "../wasi-server/wasi_server.wasm").unwrap();
    let link = linker.instantiate_async(&mut store, &module).await.unwrap();
}

But I get the following error on the let link = linker.instantiate_async(&mut store, &module).await.unwrap();:

called `Result::unwrap()` on an `Err` value: unknown import: `wasi_snapshot_preview1::fd_write` has not been defined
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

view this post on Zulip Wasmtime GitHub notifications bot (May 02 2024 at 17:55):

alexcrichton commented on issue #8521:

Ah I commented elsewhere too, but:

@maxwellflitton you might be interested in the documentation to get started here, namely you're missing a call to add_to_linker_async

view this post on Zulip Wasmtime GitHub notifications bot (Jul 26 2024 at 17:23):

alexcrichton closed issue #8521:

There's been some changes in the API, however, I'm getting the same error. My Cargo.toml has the following:

wasm-bindgen = { version = "0.2", features = ["serde-serialize"] }
wasm-bindgen-futures = "0.4.42"
bincode = "1.3.3"
tokio = { version = "1.0", features = ["full"] }
wasmtime = { version = "20.0.0", features = ["runtime", "async"] }
wasmtime-wasi = { version = "20.0.0", features = ["preview1"] }

And my code consists of the following:

use wasmtime::*;
use wasmtime_wasi::WasiCtxBuilder;
use wasmtime_wasi::preview1::wasi_snapshot_preview1::add_to_linker;

#[tokio::main]
async fn main() {
    let mut config = Config::new();
    config.async_support(true);
    let engine = Engine::new(&config).unwrap();

    let mut linker = Linker::new(&engine);

    let wasi = WasiCtxBuilder::new()
        .inherit_stdio()
        .inherit_args()
        .build_p1();
    let mut store = Store::new(&engine, wasi);

    add_to_linker(&mut linker, |s| s).unwrap();

    let module = Module::from_file(&engine, "../wasi-server/wasi_server.wasm").unwrap();
    let link = linker.instantiate_async(&mut store, &module).await.unwrap();
}

But I get the following error on the let link = linker.instantiate_async(&mut store, &module).await.unwrap();:

called `Result::unwrap()` on an `Err` value: unknown import: `wasi_snapshot_preview1::fd_write` has not been defined
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

view this post on Zulip Wasmtime GitHub notifications bot (Jul 26 2024 at 17:23):

alexcrichton commented on issue #8521:

I think this question/issue has been resolved so I'm going to close this, but if there are more questions/etc please feel free to comment.


Last updated: Dec 23 2024 at 12:05 UTC