Stream: git-wasmtime

Topic: wasmtime / issue #5639 Fib-Debug Example is not working c...


view this post on Zulip Wasmtime GitHub notifications bot (Jan 26 2023 at 12:20):

akeles85 opened issue #5639:

When I try to run fib debug example in the repository, it gives an an error like below. I tried in two different machines with different operating systems and got the same result.

➜ wasmtime git:(main) ✗ cargo run --example fib-debug
Compiling wasmtime-cli v6.0.0 (/Users/akeles/workspace/wasm/wasmtime)
Finished dev [unoptimized + debuginfo] target(s) in 0.77s
Running target/debug/examples/fib-debug
Error: expected 4 imports, found 0

I have also checked the wasm file from command line and it seems working correctly. I also can run "cargo run --example wasi" without any errors.

➜ wasmtime git:(main) ✗ wasmtime target/wasm32-wasi/debug/fib.wasm --invoke fib 2
warning: using --invoke with a function that takes arguments is experimental and may break in the future
warning: using --invoke with a function that returns values is experimental and may break in the future
3

view this post on Zulip Wasmtime GitHub notifications bot (Jan 26 2023 at 17:52):

alexcrichton commented on issue #5639:

Thanks for the report, but it looks like you updated the example to use the wasm32-wasi target rather than the wasm32-unknown-unknown target. When doing that the module may import WASI functions which means you'd need to use a Linker and wasmtime_wasi::add_to_linker to set up the WASI context.

If you use the example as-is, with the wasm32-unknown-unknown target, then it should work.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 26 2023 at 17:52):

alexcrichton closed issue #5639:

When I try to run fib debug example in the repository, it gives an an error like below. I tried in two different machines with different operating systems and got the same result.

➜ wasmtime git:(main) ✗ cargo run --example fib-debug
Compiling wasmtime-cli v6.0.0 (/Users/akeles/workspace/wasm/wasmtime)
Finished dev [unoptimized + debuginfo] target(s) in 0.77s
Running target/debug/examples/fib-debug
Error: expected 4 imports, found 0

I have also checked the wasm file from command line and it seems working correctly. I also can run "cargo run --example wasi" without any errors.

➜ wasmtime git:(main) ✗ wasmtime target/wasm32-wasi/debug/fib.wasm --invoke fib 2
warning: using --invoke with a function that takes arguments is experimental and may break in the future
warning: using --invoke with a function that returns values is experimental and may break in the future
3


Last updated: Nov 22 2024 at 16:03 UTC