Does the WASI package label wasi:io/error@0.2.0
correlate to preview 2 as metioned here?
I see mention of WASI preview 1, 2 and soon to be 3 and I see these versions for the WASI packages. Is there a corresponding wasi_snapshot_preview2.proxy.wasm for Preview 2 or does the name of these snapshot previews with wasmtime 19 not relate to what the WASI preview 2 readme says?
My components built with wasmtime 19 and embedding wasi_snapshot_preview1.proxy.wasm list imports for 0.2.0 so it seems like the preview1 snapshot is packaging 0.2.0 packages. Correct?
Preview 2 is 0.2.x
.
the filename of the adapter means that it takes preview1 wasi as input, it always has the latest version as output I think
What would the scenario of not needing to do the embed step to adapt a component? Is it a correct understanding that the step is only needed if the runtime has preview1 and the component is using preview2?
Yes; work on natively Preview 2 toolchains is underway, and when they're ready they won't need the preview1-to-preview2 adapter.
compilers currently only target preview1, so you always need to adapt to get a component. People are working on a wasm32-wasip2 compiler target, once that exists you can compile components without needing to adapt
I see an example in wasmtime that uses wasi-common to provide WASI APIs to a runtime instance. Yesterday Alex posted a wasmtime-wasi crate example so I see two different paths forward for linking WASI APIs. There's also a crate called wasi also by the bytecodealliance.
wasi-common contains a Preview 1 host implementation. Current versions of wasmtime-wasi contain a Preview 2 host implementation. Current versions of the wasi
crate contains guest bindings for Preview 2 APIs.
And using wasi-common and wasmtime-wasi require switching to nightly Rust. Is that avoiadble?
They do?
(stable rust works for me)
can_vector from the io-extras crate
error[E0554]: `#![feature]` may not be used on the stable release channel
--> /Users/adam/.cargo/registry/src/index.crates.io-6f17d22bba15001f/io-extras-0.18.1/src/lib.rs:19:33
|
19 | #![cfg_attr(can_vector, feature(can_vector))]
| ^^^^^^^^^^
Adding either of those two crates causes this error. Removing them compiles and runs.
That.. is not supposed to happen :-}.
I would run cargo clean next, I've seen the strangest things when target has been written to by different rust versions
cargo clean did the job
The crates/wasi directory in wasmtime repo is actually the crate wasmtime-wasi. Where does the wasi crate for guest bindings live?
https://github.com/bytecodealliance/wasi
If wasmtime-wasi is the preview 2 host impl and the package used by the example update PR by Alex is wasmtime-wasi::preview1, if I use wasmtime_wasi::ctx it will be preview 2? Which would mean the adapt step wouldn't be necessary?
That was a question answered by your explanation of the preview1 adapting for preview2. Had to look at the code to grok it.
Thanks for the help everyone!
~/work/learning/learn-wasm-components/runtime/rust cargo run
Compiling runtime v0.1.0 (/Users/adam/work/learning/learn-wasm-components/runtime/rust)
Finished dev [unoptimized + debuginfo] target(s) in 1.94s
Running `target/debug/runtime`
26 is even
Last updated: Nov 22 2024 at 16:03 UTC