wasi-lab
wasi-lab copied to clipboard
Error running qjs build on python or ruby wasm ext
So it is possible to compile qjuicks to wasm module. However when trying use it with python for example:
from wasmer import Instance
wasm_bytes = open('./build/qjs.wasm', 'rb').read()
instance = Instance(wasm_bytes)
print('#########')
print(instance.exports)
I get the following error:
> python3 test.py
Traceback (most recent call last):
File "test.py", line 4, in <module>
instance = Instance(wasm_bytes)
RuntimeError: Failed to instantiate the module:
19 link errors: (1 of 19) Import not found, namespace: wasi_unstable, name: fd_prestat_get (2 of 19) Import not found, namespace: wasi_unstable, name: fd_prestat_dir_name (3 of 19) Import not found, namespace: wasi_unstable, name: environ_sizes_get (4 of 19) Import not found, namespace: wasi_unstable, name: environ_get (5 of 19) Import not found, namespace: wasi_unstable, name: args_sizes_get (6 of 19) Import not found, namespace: wasi_unstable, name: args_get (7 of 19) Import not found, namespace: wasi_unstable, name: fd_read (8 of 19) Import not found, namespace: wasi_unstable, name: fd_seek (9 of 19) Import not found, namespace: wasi_unstable, name: fd_write (10 of 19) Import not found, namespace: wasi_unstable, name: fd_close (11 of 19) Import not found, namespace: wasi_unstable, name: clock_time_get (12 of 19) Import not found, namespace: wasi_unstable, name: poll_oneoff (13 of 19) Import not found, namespace: wasi_unstable, name: proc_exit (14 of 19) Import not found, namespace: wasi_unstable, name: fd_fdstat_get (15 of 19) Import not found, namespace: wasi_unstable, name: path_open (16 of 19) Import not found, namespace: wasi_unstable, name: path_rename (17 of 19) Import not found, namespace: wasi_unstable, name: path_unlink_file (18 of 19) Import not found, namespace: wasi_unstable, name: path_remove_directory (19 of 19) Import not found, namespace: wasi_unstable, name: fd_fdstat_set_flags
How to go about this?
@syrusakbary ^ do you think it's a wasmer issue rather than quickjs issue?
Did you use the latest version of wasmer? Does it run the hello world example on wasmer? The REPL won't work yet because poll_oneoff
is not yet implemented IIRC, but I don't know about the other 18 failues 😨
Latest wasmer 0.6.0, wasmer python library 0.3.0 (or ruby wasmer 0.2.0). quickjs runs succcesfully through wasmer-cli. But the python or ruby libraries cant initialize qjs.wasm. Maybe it's a issue with wasmer python/ruby libraries?
Maybe it's a issue with wasmer python/ruby libraries?
It's my only guess.
@Munawwar to run WASI in Wasmer embedded you need the WASI imports as well in Python/Ruby. We are woking on making them available. Will post updates as we continue the work there :)
@syrusakbary ^ do you think it's a wasmer issue rather than quickjs issue?
Yeah, it's a Wasmer issue/feature (not an issue in quickjs) :)