wasmerio / wasmer-java

☕ WebAssembly runtime for Java
https://medium.com/wasmer/announcing-the-first-java-library-to-run-webassembly-wasmer-jni-89e319d2ac7c
MIT License
593 stars 55 forks source link

Bump up WASI version to enable "wasi-snapshot-preview1"."proc_exit" #63

Closed kostasrim closed 1 year ago

kostasrim commented 2 years ago

Motivation

I compiled a C library to wasm which contains the following import (in the .wat file) (import "wasi-snapshot-preview1" "proc_exit" (func (;0;) (type 4)))

However, when I later use this module with java-wasmer I get the following errors:

Exception in thread "main" java.lang.RuntimeException: Failed to instantiate the module: Error while importing "wasi-snapshot-preview1"."proc_exit": unknown import. Expected Function(FunctionType { params: [I32], results: [] }).

Currently, from Cargo.toml it appears that wasmer-java is using an older version of WASI and I tried to compile wasmer-java with the updated packages:

 11 [dependencies]
 12 wasmer = { git = "https://github.com/wasmerio/wasmer", rev = "2.0.0" }
 13 wasmer-runtime = { git = "https://github.com/wasmerio/wasmer", rev = "1.0.0" }
 14 wasmer-runtime-core = { git = "https://github.com/wasmerio/wasmer", rev = "1.0.0" }

but make fails. Is there an easy way to bump up the versions?

Proposed solution

Update the WASI package versions to allow accessing the undefined WASI functions.

Alternatives

There aren't any.

Additional context

Nothing here as well. It's package versioning.

jcaesar commented 2 years ago

Two jumbled things here:

kostasrim commented 1 year ago

Thank you @jcaesar. I somehow forgot to reply and just noticed -- I am closing this :)