tpmccallum opened issue #10291:
I am compiling using the following command:
$ cargo component build --target wasm32-wasip2 Generating bindings for compress (src/bindings.rs) Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.07s
But when I use wasmtime I get an error:
$ wasmtime component run --env PATH=$PATH --dir . --invoke compress target/wasm32-wasip2/debug/compress.wasm Error: No such file or directory (os error 2)
I put the source code and config in a repo so you can see everything. Super stumped on this one, would appreciate some assistance.
https://github.com/tpmccallum/testing_components/blob/main/README.md
tpmccallum commented on issue #10291:
Here are some details of my system/setup that might help with the diagnosis:
$ rustc --version rustc 1.87.0-nightly (f8a913b13 2025-02-23)
$ cargo component --version cargo-component-component 0.20.0
$ wasmtime --version wasmtime 30.0.1
$ uname -a Darwin Kernel Version 24.3.0: X86_64
The
target/wasm32-wasip2
file exists.
I tried updatingcargo-component
, forcingwasip2
in config but output in the CLI still sayswasip1
.
Iswasmtime 30.0.1
mishandlingwasip2
components?
The auto-generatedbindings.rs
mentionwit-bindgen:0.36.0
and I am not sure if the bindings being generated are correct.
wit-bindgen:0.36.0
bjorn3 commented on issue #10291:
Does the
target/wasm32-wasip2/debug/compress.wasm
file exist?
tpmccallum commented on issue #10291:
Yes, the
target/wasm32-wasip2/debug/compress.wasm
does exist.
alexcrichton commented on issue #10291:
Thanks for the report! (and :wave:)
I think the problem here is that
wasmtime component run
isn't a subcommand of thewasmtime
executable. Coupled with Wasmtime's bad error message (which is improved at https://github.com/bytecodealliance/wasmtime/pull/10292 now) I think that led to the confusion here.When removing
component
I then get:$ wasmtime run --env PATH=$PATH --dir . --invoke compress target/wasm32-wasip2/debug/compress.wasm Error: failed to run main module `target/wasm32-wasip2/debug/compress.wasm` Caused by: using `--invoke` with components is not supported
which is expected in that
--invoke
isn't supported for components just yet.
pchickey commented on issue #10291:
expected in that --invoke isn't supported for components just yet.
Its not that far off but I haven't had the time or energy to get it over the finish line. If someone else wants to pick it up, ping me on the PR or zulip https://github.com/bytecodealliance/wasmtime/pull/10054
pchickey edited a comment on issue #10291:
expected in that --invoke isn't supported for components just yet.
Its not that far off but I haven't had the time or energy to get it over the finish line. If someone else wants to pick it up, ping me on the PR or zulip https://github.com/bytecodealliance/wasmtime/pull/10054
tpmccallum commented on issue #10291:
Thanks for the reply @bjorn3, @pchickey.
Thanks, @alexcrichton (and :wave: back).This is super helpful and appreciated.
wasip1/wasip2
Some of the confusion (notwasmtime
related specifically) was because I thought thecargo component
command supportedwasip2
. I have since learned that it does not. Based on the output I was getting when generating the bindings I thought that something was off with my config or toolchain and I chased my own tail for quite a while.Error: No such file or directory (os error 2)
Thanks for the improved error message, that makes sense now.Invoke Functionality
I went ahead and fetched @pchickey's PR to test the --invoke out locally. Here's the results:cd /Users/tpmccallum git clone https://github.com/bytecodealliance/wasmtime.git cd wasmtime git checkout main git pull origin main git checkout pch/invoke_wave git merge main cargo clean cargo build --release
I then tried to run the component and got the following result (hopefully useful feedback for the continuation of the work on https://github.com/bytecodealliance/wasmtime/pull/10054):
tpmccallum@192-168-1-17 compress % /Users/tpmccallum/wasmtime/target/release/wasmtime run --invoke compress target/wasm32-wasip1/debug/compress.wasm Error: failed to run main module `target/wasm32-wasip1/debug/compress.wasm` Caused by: 0: parsing invoke "compress" 1: unexpected end of input at 8..8
Last updated: Feb 28 2025 at 02:27 UTC