First off - thank you for this great effort!
I'm using the wasi-3.11 python.wasm artifact published here in my Rust host app (which is basically just the wasi example in this repo) and I am running into this runtime error:
Error while importing "wasi_snapshot_preview1"."sock_accept": unknown import. Expected Function(FunctionType { params: [I32, I32, I32], results: [I32] })
Here is the relevant portion of my host app:
let mut store = Store::default();
let module = Module::new(&store, wasm_bytes)?;
let load_dur = Instant::now() - load_start;
println!(" loaded in {:.3}", load_dur.as_secs_f32());
assert!(wasmer_wasi::is_wasi_module(&module), "module is not WASI");
fn say_hello_world() {
println!("Hello, from the Rust host app!");
}
let mut import_object = imports! {
"env" => {
"say_hello" => Function::new_typed(&mut store, say_hello_world),
},
};
println!("creating WASI env");
let wasi_env = WasiState::new("hello")
.finalize(&mut store)?;
import_object.extend(wasi_env.import_object(&mut store, &module)?.into_iter());
println!(" created");
println!("setting up instance and memory");
let instance = Instance::new(&mut store, &module, &import_object)?;
let memory = instance.exports.get_memory("memory")?;
wasi_env.data_mut(&mut store).set_memory(memory.clone());
// ...
My guess is that creating the Instance is failing because of the missing import, though I'm having trouble tracking down which rabbit hole to descend into to debug the situation. Do y'all have any helpful pointers?
❯ wasmer -V
wasmer 2.3.0
❯ rustc -V
rustc 1.65.0-nightly (02654a084 2022-08-30)
❯ uname -m
arm64
First off - thank you for this great effort!
I'm using the wasi-3.11 python.wasm artifact published here in my Rust host app (which is basically just the wasi example in this repo) and I am running into this runtime error:
Here is the relevant portion of my host app:
My guess is that creating the
Instanceis failing because of the missing import, though I'm having trouble tracking down which rabbit hole to descend into to debug the situation. Do y'all have any helpful pointers?