Readme Rust example without WASI?
I've tried things out for the first time, so I might be totally wrong. Hence I haven't opened a PR editing the readme, but I thought I ask first.
I've followed the steps from the Guest: Rust section of the readme. It starts with using wasm32-wasi as target. At the end you should use an adapter module to build the component. When I run wasm-tools component wit my-component.wasm I get lots of output that refers to WASI things. I guess that's correct.
But when I try to run it via Wasmtime, I get the error Error: import `wasi-stderr` not defined.
What worked for me is: Using wasm32-unknown-unknown as target. I then don't add the adapter and simply run:
wasm-tools component new ./target/wasm32-wasi/debug/my-project.wasm -o my-component.wasm
The wasm-tools component wit my-component.wasm prints out what the readme says. When I run the resulting wasm file with Wasmime, it works as expected.
Yes WASI is not required and you can use the wasm32-unknown-unknown target as you've seen. The drawback to this is that many crates and the standard library won't work, along with standard utilities like println!. I think mentioning this in the README is fine since it's basically just dropping the --adapt argument as you've seen.
And what would be the fix to get the WASI version working? Is it a Wasmtime bug?
Ah I just answered a related issue about that, namely that this repository hosts a work-in-progress implementation which will move upstream to Wasmtime eventually.