I am experiencing an error when running cargo build --target wasm32-wasi
when using the latest version of wasmtime library 0.24.0
Compiling errno v0.2.7
error[E0554]: `#![feature]` may not be used on the stable release channel
--> /home/x43/.cargo/registry/src/github.com-1ecc6299db9ec823/errno-0.2.7/src/lib.rs:20:33
|
20 | #![cfg_attr(target_os = "wasi", feature(thread_local))]
```
If I try compiling it with nightly cargo +nightly build --target wasm32-wasi
it results in error
Compiling wat v1.0.36
Compiling dirs-sys-next v0.1.2
Compiling region v2.2.0
Compiling semver v0.11.0
error[E0425]: cannot find function `lock` in module `os`
--> /home/x43/.cargo/registry/src/github.com-1ecc6299db9ec823/region-2.2.0/src/lock.rs:30:7
|
30 | os::lock(
| ^^^^ not found in `os`
|
help: consider importing this function
|
1 | use lock;
|
error[E0425]: cannot find function `unlock` in module `os`
--> /home/x43/.cargo/registry/src/github.com-1ecc6299db9ec823/region-2.2.0/src/lock.rs:60:7
|
60 | os::unlock(
| ^^^^^^ not found in `os`
|
help: consider importing this function
|
1 | use unlock;
|
error[E0425]: cannot find function `page_size` in module `os`
--> /home/x43/.cargo/registry/src/github.com-1ecc6299db9ec823/region-2.2.0/src/page.rs:16:39
|
16 | INIT.call_once(|| PAGE_SIZE = os::page_size());
| ^^^^^^^^^ not found in `os`
error[E0425]: cannot find function `set_protection` in module `os`
--> /home/x43/.cargo/registry/src/github.com-1ecc6299db9ec823/region-2.2.0/src/protect.rs:48:7
|
48 | os::set_protection(
| ^^^^^^^^^^^^^^ not found in `os`
error[E0425]: cannot find function `get_region` in module `os`
--> /home/x43/.cargo/registry/src/github.com-1ecc6299db9ec823/region-2.2.0/src/lib.rs:133:7
|
133 | os::get_region(page::floor(address as usize) as *const u8)
| ^^^^^^^^^^ not found in `os`
error: aborting due to 5 previous errors
My toml file
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
wasmtime = "0.23.0"
wasmtime-wasi = "0.24.0"
Are you looking to compile wasmtime itself to wasm32-wasi?
That isn't possible today, because wasmtime depends on several platform features not available in WASI, such as memory protections needed for JITing.
If you're looking to compile other programs to wasm32-wasi, you don't need wasmtime or wasmtime-wasi as dependencies. The Rust standard library has built in WASI support.
Thanks! I was looking at the examples. But your comment solves my issue.
Last updated: Dec 23 2024 at 13:07 UTC