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

Using the WASM file from Rust code instead of the WasmEdge CLI Tool #96

Open
skirodev opened this issue Jan 26, 2023 · 6 comments
Open

Comments

@skirodev
Copy link

I want to embed this Javascript WASM runtime by using a Rust WASM runtime in a Rust program, for example wasmer or wasmtime and so on. However, When I use wasmer and wasmer_wasi crates to write code, I realize that I encountered a problem about WASI.

Error: Error while importing "wasi_snapshot_preview1"."sock_open": unknown import. Expected Function(FunctionType { params: [I32, I32, I32], results: [I32] })

Is there any way to help me solve it here? I will be very grateful for your help.

@juntao
Copy link
Member

juntao commented Jan 26, 2023

The wasmedge_quickjs runtime depends on the async networking API provided by WasmEdge. It would not work on other Wasm implementations.

Can you use the WasmEdge Rust SDK to embed it? It is quite similar to Rust SDKs provided by the other two runtimes. Thanks.

@skirodev
Copy link
Author

skirodev commented Jan 27, 2023

The problem is that the working of the WasmEdge Rust SDK depends on the installation of WasmEdge, and it's not practical to install the WasmEdge on every user's computer because its install script keeps failing due to some weird network issues.

Is it feasible that I want to migrate the the async networking API implementation of WasmEdge to wasmer?

@juntao
Copy link
Member

juntao commented Jan 27, 2023

Hmm, what are the networking issues you are encountering? I think our installer files are hosted on GitHub. But we can also mirror it somewhere else.

You are welcome to port the wasmedge socket impl to wasmer or wasmtime, but it is likely to be a big task since those are written in different languages.

@skirodev
Copy link
Author

skirodev commented Jan 28, 2023

Running command with VPN:

skiro@MacBook-Pro ~ % sudo curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -p /usr/local
Password: ********
Using Python: /usr/local/bin/python3
curl: (56) LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 60

Running command without VPN:

skiro@MacBook-Pro ~ % sudo curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -p /usr/local
Using Python: /usr/local/bin/python3
Compatible with current configuration
Running Uninstaller
CRITICAL- Error opening file: /usr/local/env error: Permission denied
ERROR   - Not able to write to env file
WARNING - SHELL variable not found. Using zsh as SHELL
shell configuration updated
Downloading WasmEdge
|===============================                             | 53.05 %Traceback (most recent call last):
  File "<stdin>", line 1524, in <module>
  File "<stdin>", line 1309, in main
  File "/usr/local/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 278, in urlretrieve
    raise ContentTooShortError(
urllib.error.ContentTooShortError: <urlopen error retrieval incomplete: got only 13205504 out of 24892048 bytes>

I have run the above command on MacOS Big Sur 11.7 in China.

Might be useful info is that when I ran the installation scripts of Wasmer and Wasmtime, it was very smooth and completed within 5 seconds. Also worth noting that not every user is willing to install Python for WasmEdge.

@alabulei1
Copy link
Member

Hi @skirodev

Sorry for the inconvenience. Because the installation of WasmEdge depends on rawgithubcontents.com, which doesn't work well in China. I think https://ghproxy.com/ can help solve this problem. Let me know if this works. Thanks.

BTW, we're also looking for more advanced solutions. Do you have any suggestions?

@guest271314
Copy link

You are welcome to port the wasmedge socket impl to wasmer or wasmtime, but it is likely to be a big task since those are written in different languages.

What are the source files?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants