wasmerio / wasmer

🚀 The leading Wasm Runtime supporting WASIX and WASI
https://wasmer.io
MIT License
19.02k stars 813 forks source link

Importing wasm module that uses wasmer-wasix #4718

Open fgrebenac opened 6 months ago

fgrebenac commented 6 months ago

Summary

Can't import wasm module that uses wasmer-wasix.

Additional details

I'm trying to import wasm module that uses tokio and reqwest crates from https://github.com/wasix-org using wasmer-wasix as explained in examples. I compile wasm module with cargo wasix build --release and run the main Rust program with cargo run --release. When I try to import it using WasiEnv from wasmer-wasix crate, I get the following error: Error: Link(Import("wasix_32v1", "futex_wake", UnknownImport(Function(FunctionType { params: [I32, I32], results: [I32] }))))

It happens when I'm trying to create new Instance from import object.

Does anyone know why this happens and how can I fix it?

syrusakbary commented 6 months ago

Hey @fgrebenac, can you post here the full .wasm file (probably attached as a Zip). If you have also the source code that would be even better.

This may be happening because there might be an extra import outside what WASIX can recognize, and that's makes the WASIX crate not recognize all the imports, and not provide the required WASIX imports

fgrebenac commented 6 months ago

Thanks for answering.

I'm attaching a zip file with source code and .wasm file.

In root folder there are Wasm and Main folders, and gpio_module.wasm file - wasm compiled with cargo wasix build --release command.

Wasm folder contains Cargo.toml and lib.rs files of Rust project that is getting compiled to wasm. Main folder contains source code of the program that is supposed to import the module.

Wasmer-files.zip

fgrebenac commented 5 months ago

Any updates on this issue?