You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ python3 main.py
Traceback (most recent call last):
File "..../test-py-wasmtime/main.py", line 17, in <module>
main()
File "..../test-py-wasmtime/main.py", line 13, in main
instance = linker.instantiate(store=store, module=module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "..../test-py-wasmtime/.venv/lib/python3.11/site-packages/wasmtime/_linker.py", line 171, in instantiate
raise WasmtimeError._from_ptr(error)
wasmtime._error.WasmtimeError: unknown import: `wasi_snapshot_preview1::sched_yield` has not been defined
Expected behaviour
It should not throw an exception, sched_yield should be defined in the WASI imports.
The same WASM binary runs with the wasmtime CLI
$ wasmtime --version
wasmtime-cli 17.0.0 (ab5a4484e 2024-01-25)p
$ wasmtime run starlark.wasm 'main = lambda: print("hello world")'
hello world
Additional Context
OS: MacOS Sonoma 14.3.1
Platform: Apple M1 chip
The text was updated successfully, but these errors were encountered:
Update
Fixed by calling
linker.define_wasi()
https://github.com/amaranth-lang/amaranth-yosys/blob/17a79d937509c3412ffb778d55a5d6bc9c8b76d2/amaranth_yosys/__main__.py#L23Please include a proper example of using WASI and other custom imports instead of just the bare-bones opinionated
wasmtime.loader
example https://github.com/bytecodealliance/wasmtime-py/blob/main/examples/loader.pyOverview
Steps to reproduce
Create a python
venv
and install the dependenciesRun this code with
python3 main.py
The
starlark.wasm
file imports 20 WASI host functionsstarlark.wasm.zip
Actual behaviour
Expected behaviour
It should not throw an exception,
sched_yield
should be defined in the WASI imports.The same WASM binary runs with the wasmtime CLI
Additional Context
OS: MacOS Sonoma 14.3.1
Platform: Apple M1 chip
The text was updated successfully, but these errors were encountered: