Skip to content

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

Description

@ZZK-AJ

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ❓ questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions