bytecodealliance / componentize-py

Apache License 2.0
130 stars 13 forks source link

Issue encountered when trying to execute app.wasm using wasmtime #89

Closed iamshreeram closed 2 months ago

iamshreeram commented 2 months ago

Hi, After following the instructions in README.md to set up the component and execute it using wasmtime, the application fails to start with the following error message:

Error: failed to run main module `app.wasm`

Caused by:
    exported instance `wasi:cli/run@0.2.0` not present

Code is here

dicej commented 2 months ago

Hi @iamshreeram. Thanks for reporting this. wasmtime run only knows how to run components targeting the wasi-cli world. It does not (as of this writing) know how to run components targeting arbitrary worlds like the hello world in the README.md example.

If you want to build a wasi-cli command, take a look at the CLI example. If you want to run a component targeting an arbitrary world, you'll need to write a custom embedding of Wasmtime or other component runtime (e.g. Jco); see the sandbox example for one way to do that.

dicej commented 2 months ago

Since you're not the first person to ask about this, I'll expand the README.md example with instructions for running the component.

dicej commented 2 months ago

90 should address this. Please let me know if it still isn't clear.