Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run wasmtime component (Error: No such file or directory (os error 2)) #10291

Open
tpmccallum opened this issue Feb 25, 2025 · 4 comments

Comments

@tpmccallum
Copy link

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
Copy link
Author

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 updating cargo-component, forcing wasip2 in config but output in the CLI still says wasip1.
Is wasmtime 30.0.1 mishandling wasip2 components?
The auto-generated bindings.rs mention wit-bindgen:0.36.0 and I am not sure if the bindings being generated are correct.
wit-bindgen:0.36.0

@bjorn3
Copy link
Contributor

bjorn3 commented Feb 25, 2025

Does the target/wasm32-wasip2/debug/compress.wasm file exist?

@tpmccallum
Copy link
Author

Yes, the target/wasm32-wasip2/debug/compress.wasm does exist.

@alexcrichton
Copy link
Member

Thanks for the report! (and 👋)

I think the problem here is that wasmtime component run isn't a subcommand of the wasmtime executable. Coupled with Wasmtime's bad error message (which is improved at #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants