Stream: git-wasmtime

Topic: wasmtime / issue #5621 examples/hello.wat throws


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

guest271314 opened issue #5621:

$ ./wasmtime hello.wat
Error: failed to run main module `hello.wat`

Caused by:
    0: failed to instantiate "hello.wat"
    1: unknown import: `::hello` has not been defined

view this post on Zulip Wasmtime GitHub notifications bot (Jan 23 2023 at 15:22):

bjorn3 commented on issue #5621:

hello.wat imports a function called hello which it then calls. You need to pass in a definition for this import when instantiating the wasm module. This is something that can only be done from the wasmtime api, not the wasmtime cli. See https://github.com/bytecodealliance/wasmtime/blob/c9bc0efef559865fb0c8dc48c757b0a6d969b517/examples/hello.rs#L51-L52 The wasmtime cli is mostly useful for running WASI programs, which hello.wat is not. For a wasi example you can run using the wasmtime cli see examples/wasi/wasm/wasi.rs.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 23 2023 at 15:29):

guest271314 commented on issue #5621:

So I can run heelo.rs directly with wasmtime? It would be helpful if the distinction was clear exactly what wasmtime can run and what it can't out of the box re WASI/WASM.

I was testing wasmedge earlier substituted for wasmtime and it does not run a Native Messaging host out of the box, the host exits. Is that based on the same constraints?

view this post on Zulip Wasmtime GitHub notifications bot (Jan 23 2023 at 15:33):

guest271314 commented on issue #5621:

This is something that can only be done from the wasmtime api, not the wasmtime cli.

What is the difference?

How is a novice in WebAssembly supposed to know there is a difference between wasmtime _api_ and wasmtime _cli_, or that they are two different animals that exist under the name wasmtime by reading README?

view this post on Zulip Wasmtime GitHub notifications bot (Jan 23 2023 at 16:40):

bjorn3 commented on issue #5621:

So I can run heelo.rs directly with wasmtime?

Not when using the wasmtime cli.

I was testing wasmedge earlier substituted for wasmtime and it does not run a Native Messaging host out of the box, the host exits. Is that based on the same constraints?

I'm not familiar with wasmedge so I have no clue why that doesn't work.

What is the difference?

The wasmtime api is what you would call when using wasmtime as library. The wasmtime cli is a commandline interface built on top of the wasmtime api. It is less flexible, but more convenient if your wasm module fits within the basic shape it expects (a wasi program that doesn't require any non-wasi imports)

view this post on Zulip Wasmtime GitHub notifications bot (Jan 24 2023 at 00:58):

guest271314 commented on issue #5621:

The wasmtime api is what you would call when using wasmtime as library. The wasmtime cli is a commandline interface built on top of the wasmtime api. It is less flexible, but more convenient if your wasm module fits within the basic shape it expects (a wasi program that doesn't require any non-wasi imports)

I am not gathering what is going on. I expected wasmtime to just work. I didn't know there was two entirely different wasmtime programs emanting from this single repository. I'll close this.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 24 2023 at 00:58):

guest271314 closed issue #5621:

$ ./wasmtime hello.wat
Error: failed to run main module `hello.wat`

Caused by:
    0: failed to instantiate "hello.wat"
    1: unknown import: `::hello` has not been defined


Last updated: Oct 23 2024 at 20:03 UTC