Closed oovm closed 5 months ago
Hi,
With wasmtime v16.0.0 (6613acd1e 2023-12-20) it happens more or less the same
When I execute the hello-wasi-http.wasm as follows
wasmtime serve target/wasm32-wasi/debug/hello_wasi_http.wasm
I get the following error:
Error: import `wasi:cli/environment@0.2.0-rc-2023-12-05` has the wrong type
Caused by:
0: instance export `get-environment` has the wrong type
1: expected func found nothing
@sunfishcode any update on this?
Hello @rperez95!
I was experimenting this problem as well, but seems that adding the -Scommon
flag to the serve
command helped. It adds the preview_2::command
to the linker.
So, doing wasmtime serve -Scommon target/wasm32-wasi/debug/hello_wasi_http.wasm
should fix the issue.
Although the error is similar to the reported issue originally, I think they are different issues.
Hi @ereslibre!
Adding the -Scommon flag to the wasmtime serve command fixed the issue. Now it works perfectly!
Thx!
Yes, -Scommon may work as a workaround. I'm investigating that and working on updating this repo to Wasmtime 17 and Preview 2 in https://github.com/sunfishcode/hello-wasi-http/pull/7.
I believe this is now fixed by #7, which updates the repo to Preview2 and Wasmtime 17. Please re-open this or file new issues if anything doesn't work!
I cannot execute the project successfully
Here are my steps:
wasmtime -V
cargo component build
cargo component upgrade --no-install
no problem, update to 0.5.0
wasmtime serve target/wasm32-wasi/debug/hello_wasi_http.wasm