Stream: general

Topic: wasm-tools component embed


view this post on Zulip Jonathan Casters (Mar 03 2025 at 14:47):

How can one make the wasi namespace available to the wasm-tools component embed command?

I'm trying to include [wasi:cli/imports@0.2.0](https://wa.dev/wasi:cli) (of which the source code can be found here):

  cat wit/add.wit
package docs:adder@0.1.0;
world adder {
  include wasi:cli/imports@0.2.0;
  export add: func(x: s32, y: s32) -> s32;
}
  wasm-tools component embed ./wit/add.wit
error: package not found
     --> ./wit/add.wit:3:11
      |
    3 |   include wasi:cli/imports@0.2.0;
      |           ^-------

I'm following this component model tutorial where the compilation using TinyGo is dependent on this wasm-tools component embed command:

 tinygo build -target=wasip2 -o add.wasm --wit-package wit/add.wit --wit-world adder main.go
error: package 'wasi:io@0.2.0' not found. no known packages.
     --> wit/add.wit:3:10
      |
    3 |   import wasi:io/streams@0.2.0;
      |          ^------
`wasm-tools component embed` failed: exit status 1
Command-Line Interface (CLI) World for WASI. Contribute to WebAssembly/wasi-cli development by creating an account on GitHub.

Last updated: Apr 07 2025 at 02:31 UTC