lyuxiaosu opened issue #6626:
I have a C code using WASI and was compiled to .wasm. I can use wasmtime to execute it successfully. I then used wasm2wat tool to convert .wasm to .wat. Then I replaced the .wat file in
wasmtime/examples /hello.c
with my converted .wat file to build and have a test (I also replaced _run_ function with __start_). However, when I executed it, it gave the following error:$ ./wasmtime_test Initializing... Compiling module... Creating callback... Instantiating module... error: failed to instantiate expected 8 imports, found 1
Any suggestions for me about this? Is it possible that wasm2wat did something wrong? Thanks very much.
bjorn3 commented on issue #6626:
I believe the
hello.c
example doesn't work with WASI modules. Thelinking.c
example should work though. As written it links two wasm modules together and additionally links the wasi implementation. You will probably want to change it to only link a single wasm module and the wasi implementation. I think removing https://github.com/bytecodealliance/wasmtime/blob/d24282c1fffa6773dca855919985a0a92fc1ee34/examples/linking.c#L81-L90 would work for that.
lyuxiaosu commented on issue #6626:
@bjorn3 thanks a lot, it works. I made little change for linking.c and it works. This is really help. wasmtime's documentation and examples are really excellent.
lyuxiaosu closed issue #6626:
I have a C code using WASI and was compiled to .wasm. I can use wasmtime to execute it successfully. I then used wasm2wat tool to convert .wasm to .wat. Then I replaced the .wat file in
wasmtime/examples /hello.c
with my converted .wat file to build and have a test (I also replaced _run_ function with __start_). However, when I executed it, it gave the following error:$ ./wasmtime_test Initializing... Compiling module... Creating callback... Instantiating module... error: failed to instantiate expected 8 imports, found 1
Any suggestions for me about this? Is it possible that wasm2wat did something wrong? Thanks very much.
lyuxiaosu commented on issue #6626:
This issue was solved.
Last updated: Nov 22 2024 at 16:03 UTC