bytecodealliance / bytecodealliance/wit-bindgen

Readme Rust example without WASI?

Aperta
#523 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Rust
Stelle
1.5k
Fork
288
Merge medio
6h 32m
PR unite (30g)
19

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dalla sezione Guest: Rust del README e confronta i relativi comandi wasm32-wasi, adapter-module e Wasmtime con l'errore wasi-stderr segnalato. Riproduci entrambi i flussi wasm32-wasi e wasm32-unknown-unknown usando wasm-tools, quindi aggiorna le istruzioni solo se il flusso funzionante viene confermato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust, wasm
Ambito
documentation
Tipo di issue
Documentazione
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.