wasi2
- First, download the appropriate tarball below
- Extract it, it'll make a directory called
wasi
- Execute
rustup toolchain link wasi $PWD/wasi
- Execute
rustc +wasi -vV
and make sure it works - Create
hello.rs
which is the standard rust hello world rustc +wasi hello.rs --target wasm32-unknown-wasi
- Clone https://github.com/cranestation/wasmtime-wasi
cargo run --bin wasmtime /path/to/hello.wasm
If you want to interoperate with C code, then finish step 4 above and follow afterwards with:
- Clone https://github.com/cranestation/wasmception-wasi
- Run
make
inside there
- This'll take quite awhile as it builds clang
rustc +wasi hello.rs --target wasm32-unknown-wasi -C target-feature=-crt-static -C linker=/path/to/wasmception-wasi/dist/bin/clang