bytecodealliance / bytecodealliance/wit-bindgen

Readme Rust example without WASI?

Open
#523 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.5k
Forks
286
Avg merge
6h 32m
Merged PRs (30d)
19

Description

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](https://github.com/bytecodealliance/wit-bindgen/tree/eeba5da107a992930c0f6b95a0d66b10ff69eebc#guest-rust). 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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.