Open casimiro opened 11 months ago
This is similar to the discussion in https://github.com/wasmerio/wasmer/discussions/4299
In short: you have to use a custom VirtualTaskManager
with your own thread pool.
Thank you for the quick reply, @theduke.
Since I'm not embedding Wasmer within another Rust application, I tried to circumvent the thread pool creation in wasix by removing the sys-thread
feature from the wasix
dependency in lib/c-api/Cargo.toml
:
wasmer-wasix = { version = "0.16.0", path = "../wasix", default-features = false, features = ["sys", "logging"], optional = true }
But the compilation C library stops with the following error:
Compiling wasmer-middlewares v4.2.3 (/home/casimiro/KongHQ/wasmx/work/runtimes/libwasmer/repos/wasmer/lib/middlewares)
warning: unused import: `crate::PluggableRuntime`
--> lib/wasix/src/state/builder.rs:17:5
|
17 | use crate::PluggableRuntime;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
Compiling cranelift-frontend v0.91.1
warning: `wasmer-wasix` (lib) generated 1 warning (run `cargo fix --lib -p wasmer-wasix` to apply 1 suggestion)
error[E0432]: unresolved import `wasmer_wasix::runtime::task_manager::tokio`
--> lib/c-api/src/wasm_c_api/wasi/mod.rs:23:29
|
23 | runtime::task_manager::{tokio::TokioTaskManager, InlineWaker},
| ^^^^^ could not find `tokio` in `task_manager`
From the discussion in the referenced issue and the output above I assume it's currently not possible to compile the Wasmer C library without sys-thread
(i.e., without rayon
) by simply disabling features in Cargo files.
Summary
rayon
is listed as an optional dependency ofwasix
, however it seems impossible to buildwasix
withoutrayon
.Additional details
Being able to compile wasix without
rayon
is useful when embedding the C library in environments where thread pooling doesn't make sense.See https://github.com/wasmerio/wasmer/issues/4113