Skip to content

wasi2

Compare
Choose a tag to compare
@alexcrichton alexcrichton released this 13 Mar 17:42
  1. First, download the appropriate tarball below
  2. Extract it, it'll make a directory called wasi
  3. Execute rustup toolchain link wasi $PWD/wasi
  4. Execute rustc +wasi -vV and make sure it works
  5. Create hello.rs which is the standard rust hello world
  6. rustc +wasi hello.rs --target wasm32-unknown-wasi
  7. Clone https://github.com/cranestation/wasmtime-wasi
  8. 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:

  1. Clone https://github.com/cranestation/wasmception-wasi
  2. Run make inside there
  • This'll take quite awhile as it builds clang
  1. rustc +wasi hello.rs --target wasm32-unknown-wasi -C target-feature=-crt-static -C linker=/path/to/wasmception-wasi/dist/bin/clang