Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run the .wasm file I compiled that make a problem. I want to know the author of this project compile the rust to .wasm file. #68

Open
ZZK-AJ opened this issue Jul 14, 2022 · 0 comments
Labels
❓ question Further information is requested

Comments

@ZZK-AJ
Copy link

ZZK-AJ commented Jul 14, 2022

Summary

I use the code like the tutorial ,
#[no_mangle] pub extern fn sum(x: i32, y: i32) -> i32 { x + y }
and use: cargo build --target=wasm32-wasi to compile my rust code to .wasm file.
and I run the .wasm file like this wasmtime hello-rust2wasm.wasm, it can worked.
but when I call the .wasm file in Java it comes an error.
Exception in thread "main" java.lang.RuntimeException: Failed to instantiate the module: Error while importing "wasi_snapshot_preview1"."fd_write": unknown import. Expected Function(FunctionType { params: [I32, I32, I32, I32], results: [I32] })
but if I use the author's file simple.wasm show in README. it can work.

so I want to know how the author compiles the rust to wasm and where I can learn the method.

Additional details

Provide any additional details here.

@ZZK-AJ ZZK-AJ added the ❓ question Further information is requested label Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓ question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant