vmware-labs / webassembly-language-runtimes

Wasm Language Runtimes provides popular language runtimes (Ruby, Python, …) precompiled to WebAssembly that are tested for compatibility and kept up to date when new versions of upstream languages are released
Apache License 2.0
327 stars 27 forks source link

wasmer support #106

Closed liudonghua123 closed 1 year ago

liudonghua123 commented 1 year ago

Is your feature request related to a problem? Please describe.

I tried to execute python-3.11.3.wasm download from https://github.com/vmware-labs/webassembly-language-runtimes/releases/tag/python%2F3.11.3%2B20230428-7d1b259 within my wasmer, but it failed with the following errors.

D:\Downloads>wasmer run python-3.11.3.wasm
error: failed to run `python-3.11.3.wasm`
│   1: failed to instantiate WASI module
│   2: Instantiation failed
╰─▶ 3: Error while importing "wasi_snapshot_preview1"."sock_accept": unknown import. Expected Function(FunctionType { params: [I32, I32, I32], results: [I32] })

D:\Downloads>
D:\Downloads>wasmer run --dir . python-3.11.3.wasm
error: failed to run `python-3.11.3.wasm`
│   1: failed to instantiate WASI module
│   2: Instantiation failed
╰─▶ 3: Error while importing "wasi_snapshot_preview1"."sock_accept": unknown import. Expected Function(FunctionType { params: [I32, I32, I32], results: [I32] })

And I read https://wasmlabs.dev/articles/python-wasm32-wasi/, and it seems python-3.11.3.wasm can be run on wasmtime only and python-3.11.3-wasmedge.wasm can be run on wasmedge.

I have also problems when running on wasmedge on windows for --dir option. see https://github.com/WasmEdge/WasmEdge/issues/1918.

D:\Downloads>wasmedge --dir /:D:/Downloads/ python-3.11.3-wasmedge.wasm
[2023-06-05 10:27:27.048] [error] Bind guest directory failed:44
^C
D:\Downloads>wasmedge --dir /:D:\Downloads\ python-3.11.3-wasmedge.wasm
[2023-06-05 10:27:37.568] [error] Bind guest directory failed:44
^C
D:\Downloads>
D:\Downloads>wasmtime run --mapdir /::D:/Downloads python-3.11.3.wasm
Python 3.11.3 (tags/v3.11.3:f3909b8, Apr 28 2023, 09:49:53) [Clang 15.0.7 ] on wasi
Type "help", "copyright", "credits" or "license" for more information.
>>> 1+2
3
>>> exit()

D:\Downloads>

Is there any plans to support wasmer.

Describe the solution you'd like

N.A.

Describe alternatives you've considered

No response

Additional context

No response

assambar commented 1 year ago

Hey @liudonghua123 thanks a lot for the interest and reporting this. The problem comes form wasmer not being fully compliant to the latest preview1 ABI.

sock_accept got added some time after the initial preview1 release and is already supported by latest versions of major runtimes like wasmtime, wamr, wazero, node,js (listed in order I tried them).

We built python.wasm on top of wasi-libc which depends on this method.


As I see this has been fixed for the latest wasmer (and you have also verified it) - https://github.com/wasmerio/wasmer/issues/3170

Therefore I will be closing this issue.