wasix-org / cargo-wasix Goto Github PK
View Code? Open in Web Editor NEWCargo wrapper for working with Webassembly wasi(x).
License: Apache License 2.0
Cargo wrapper for working with Webassembly wasi(x).
License: Apache License 2.0
Generate pre-built cargo-wasix binaries for releases, and provide them through a Github release.
The building should be done in a CI task.
Running cargo wasix build
produces the following output:
$ cargo wasix build
/home/ben/.rustup/toolchains/wasix/bin/rustc: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.36' not found (required by /home/ben/.rustup/toolchains/wasix/lib/librustc_driver-239bacfa42cce6c3.so)
error: Could not execute rustc
Caused by:
failed to execute "rustc" "+wasix" "--print" "sysroot"
status: exit status: 1
My currently installed version of glibc
is 2.35
.
Will wasix
support glibc
version 2.35
or will people need to update their glibc
version to run wasix
?
The tests (cargo test
) are currently broken.
Need to fix them and make the CI pass again.
Hi, I am trying to run cargo wasix test
for my project with this Cargo.toml
, but I got this error. I cannot find any clue to fix it. Any ideas? Thanks!
[dependencies]
tokio = { version = "=1.24.2", features = ["full"] }
[patch.crates-io]
socket2 = { git = "https://github.com/wasix-org/socket2.git", branch = "v0.4.7" }
libc = { git = "https://github.com/wasix-org/libc.git" }
tokio = { git = "https://github.com/wasix-org/tokio.git", branch = "wasix-1.24.2" }
info: Post-processing WebAssembly files
Running `/Users/al/.cargo/target/wasm32-wasmer-wasi/debug/deps/showbiz_wasm-fcdd37f471140938.wasm`
warning: Found more than 1 WASI version in this module (`wasi_snapshot_preview1`, `wasix_32v1`). If this is intentional, pass `--allow-multiple-wasi-versions` to suppress this warning.
error: failed to run `/Users/al/.cargo/target/wasm32-wasmer-wasi/debug/deps/showbiz_wasm-fcdd37f471140938.wasm`
│ 1: failed to instantiate WASI module
│ 2: Instantiation failed
╰─▶ 3: Error while importing "wasix_32v1"."sock_accept_v2": unknown import. Expected Function(FunctionType { params: [I32, I32, I32, I32], results: [I32] })
Hi I'm a bit compile hello world and then load it in the browser with the following. Are you able to do an example with this to point people in the right direction
Thanks
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Page Title</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<!-- <link rel='stylesheet' type='text/css' media='screen' href='main.css'> -->
<script lang="ts">
const importObject = {
module: {},
env: {
memory: new WebAssembly.Memory({ initial: 256 }),
}
};
const response = fetch('/wasmix-play.wasm').then((response) =>
response.arrayBuffer()
).then((bytes) => WebAssembly.instantiate(bytes, importObject)
).then((instance) => {
console.log(instance.exports);
});
</script>
</head>
<body>
</body>
</html>```
Cargo wasix run fails with this error:
error: no such command: `+wasix`
Cargo does not handle `+toolchain` directives.
Did you mean to invoke `cargo` through `rustup` instead?
Attempting to install the toolchain on a very slow (KB/s) hangs on Extracting...
but I believe that message is printed too early, while the download is progressing still:
Lines 602 to 612 in 07d5637
Some minimal progress bar would be great, but at least ensuring that it is clear what is blocking the install step-wise would be a very nice fix to have.
Hey all, first off: congratulations on putting this system interface and tooling around it together! I know how much work goes into something like this, even if you can reuse so much existing code.
Unfortunately there is a sizable problem with the name you chose, which I have no doubt is a simple oversight: since early in 2022, WASIX
has been in use for an open source project by SingleStore Labs, originally developed for their port of cpython to WASI. At one point it was also used by the official cpython distribution.
Given that this project is very much in the same space as your system interface, this name collision would be bound to cause a great deal of confusion once you announce more widely.
I'm glad I stumbled upon this before a big announcement could be made, since I know @syrusakbary's very strong stance against using names already taken by other projects in a related space (see e.g. here, here, and here), and hence that he'd certainly agree that continued use of this name would be the wrong thing to do.
(Note: I would have filed this on the wasix-libc repo, but it has issues disabled.)
There is still issue with the naming of toolchain for windows
Originally posted by @Loga-Shanmugam in #11 (comment)
When building / running for the first time on Windows, the downloaded toolchain cannot be found.
$ cargo wasix build --release
Finding latest release... (https://api.github.com/repos/wasix-org/rust/releases/latest)...
Toolchain path C:\Users\twitc\AppData\Roaming\cargo-wasix\toolchains\x86_64-pc-windows-msvc_v2023-05-26.1 already exists - deleting existing files!
Downloading sysroot from url 'https://github.com/wasix-org/rust/releases/download/v2023-05-26.1/wasix-libc.tar.gz'...
Extracting...
Downloading Rust toolchain from url 'https://github.com/wasix-org/rust/releases/download/v2023-05-26.1/rust-toolchain-x86_64-pc-windows-msvc.tar.gz'...
Extracting...
Downloaded toolchain x86_64-pc-windows-msvc to C:\Users\twitc\AppData\Roaming\cargo-wasix\toolchains\x86_64-pc-windows-msvc_v2023-05-26.1\rust
Activating rustup toolchain wasix at C:\Users\twitc\AppData\Roaming\cargo-wasix\toolchains\x86_64-pc-windows-msvc_v2023-05-26.1\rust...
error: Invalid toolchain directory: rustc executable not found at C:\Users\twitc\AppData\Roaming\cargo-wasix\toolchains\x86_64-pc-windows-msvc_v2023-05-26.1\rust\bin/rustc
The binary is present, so it seems like wasix may be looking for exactly rustc
instead of rustc.exe
?
Installation instructions on https://wasix.org/docs/language-guide/rust/installation are not helpful, as they do not provide link how to troubleshoot if installation does not work:
$ cargo install cargo-wasix
Updating crates.io index
Ignored package `cargo-wasix v0.1.23` is already installed, use --force to override
$ cargo wasix --version
cargo-wasix 0.1.23
$ rustup toolchain list | grep wasix
$ rustup toolchain list | grep wasix | wc
0 0 0
$ rustup toolchain install wasix
error: invalid toolchain name: 'wasix'
I am using Archlinux. Probably adding link on https://wasix.org/docs/language-guide/rust/installation to more detailed explanation or troubleshooting would be helpful.
The CI is currently red due to one failing test.
Probably just some STDOUT/ERR that changed in upstream cargo.
Need to investigate.
The link https://wasmer.io/install.sh does not exist now, and I think curl https://get.wasmer.io -sSfL | sh
is a correct way for installation.
# cargo wasix run
error: failed to find `wasmer` in $PATH, you'll want to install `wasmer` before running this command
you can also install through a shell:
curl https://wasmer.io/install.sh -sSf | bash
https://wasix.org/docs/language-guide/rust/installation
$ rustup target list | grep wasix
After following the (easy) install instructions, the toolchain is not installed immediately. Rather, AFAIK you must either manually install or attempt to use the installed tool once for it to install https://api.github.com/repos/wasix-org/rust/releases/latest
On a fresh install of Debian 11 with the latest rustup 1.26.0
following this plan:
mkdir app && cd app
cargo init
cargo install cargo-wasix
cargo wasix build
The toolchain reports that it's linked & available, but I get a ton of errors related to libc not found. Then a final "could not execute rustc"
dev@localhost:~/app$ cargo wasix build
Finding latest release... (https://api.github.com/repos/wasix-org/rust/releases/latest)...
Downloading sysroot from url 'https://github.com/wasix-org/rust/releases/download/v2023-07-21.1/wasix-libc.tar.gz'...
Extracting...
Downloading Rust toolchain from url 'https://github.com/wasix-org/rust/releases/download/v2023-07-21.1/rust-toolchain-x86_64-unknown-linux-gnu.tar.gz'...
Extracting...
Downloaded toolchain x86_64-unknown-linux-gnu to /home/dev/.local/share/cargo-wasix/toolchains/x86_64-unknown-linux-gnu_v2023-07-21.1/rust
Activating rustup toolchain wasix at /home/dev/.local/share/cargo-wasix/toolchains/x86_64-unknown-linux-gnu_v2023-07-21.1/rust...
Running rustup toolchain link wasix /home/dev/.local/share/cargo-wasix/toolchains/x86_64-unknown-linux-gnu_v2023-07-21.1/rust:
rustup toolchain wasix was linked and is now available!
/home/dev/.rustup/toolchains/wasix/bin/rustc: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /home/dev/.rustup/toolchains/wasix/bin/rustc)
/home/dev/.rustup/toolchains/wasix/bin/rustc: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /home/dev/.rustup/toolchains/wasix/lib/librustc_driver-239bacfa42cce6c3.so)
/home/dev/.rustup/toolchains/wasix/bin/rustc: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /home/dev/.rustup/toolchains/wasix/lib/librustc_driver-239bacfa42cce6c3.so)
/home/dev/.rustup/toolchains/wasix/bin/rustc: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /home/dev/.rustup/toolchains/wasix/lib/librustc_driver-239bacfa42cce6c3.so)
/home/dev/.rustup/toolchains/wasix/bin/rustc: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /home/dev/.rustup/toolchains/wasix/lib/librustc_driver-239bacfa42cce6c3.so)
/home/dev/.rustup/toolchains/wasix/bin/rustc: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /home/dev/.rustup/toolchains/wasix/lib/librustc_driver-239bacfa42cce6c3.so)
/home/dev/.rustup/toolchains/wasix/bin/rustc: /lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.13' not found (required by /home/dev/.rustup/toolchains/wasix/lib/librustc_driver-239bacfa42cce6c3.so)
/home/dev/.rustup/toolchains/wasix/bin/rustc: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /home/dev/.rustup/toolchains/wasix/lib/libstd-9047e6e40084bd20.so)
/home/dev/.rustup/toolchains/wasix/bin/rustc: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /home/dev/.rustup/toolchains/wasix/lib/libstd-9047e6e40084bd20.so)
/home/dev/.rustup/toolchains/wasix/bin/rustc: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /home/dev/.rustup/toolchains/wasix/lib/libstd-9047e6e40084bd20.so)
error: Could not execute rustc
Caused by:
failed to execute "rustc" "+wasix" "--print" "sysroot"
status: exit status: 1
The first reason is that rustc
will already point to the system installed Rust:
~/.rustup/toolchains ❯ command -v rustc
/etc/profiles/per-user/odd/bin/rustc
~/.rustup/toolchains ❯ rustc +wasix --print sysroot
error: couldn't read +wasix: No such file or directory (os error 2)
The second reason is that the downloaded files such as rustc
and rustdoc
needs to be patched with patchelf
, otherwise they won't run due to assuming paths for dependencies:
toolchains/wasix/bin ❯ pwd
/home/odd/.rustup/toolchains/wasix/bin
toolchains/wasix/bin ❯ ls
rustc rustdoc
toolchains/wasix/bin ❯ ./rustc
bash: ./rustc: cannot execute: required file not found
Nix stores these dependencies in /nix/store
, which is why they need patching.
Hello, I have been trying to publish to wasmer.io following the wasix guide.
I have added the wasm32-wasmer-wasi
target but am under the understanding I can publish wasix
binaries to wasmer as well?
When I build my project with cargo wasix buid --release
I get a binary in ./target/wasm32-wasmer-wasi/release/foo.wasm
.
My wasmer.toml
contains the following:
[[module]]
name = 'foo'
source = './target/wasm32-wasmer-wasi/release/foo.wasm'
abi = 'wasi'
However when I try to wasmer publish
I get the following error:
error: WASM file "/home/***/target/wasm32-wasmer-wasi/release/foo.wasm" detected as invalid because InterfaceViolated { errors: ["Missing import \"wasix_32v1\" \"thread_exit\"", "Missing import \"wasix_32v1\" \"futex_wait\"", "Missing import \"wasix_32v1\" \"thread_signal\"", "Missing import \"wasix_32v1\" \"futex_wake_all\"", "Missing import \"wasix_32v1\" \"futex_wake\"", "Missing import \"wasix_32v1\" \"getcwd\"", "Missing import \"wasix_32v1\" \"callback_signal\""] }
However I can
$ wasmer run /home/***/target/wasm32-wasmer-wasi/release/foo.wasm
Hello, world!
So the binary is definitely located at that path. Is there another target I need in order to publish to wasmer.io? Is it required to use the wasi
target? Or are wasix
binaries also allowed?
Hi,
I just installed cargo-wasix with cargo install cargo-wasix
but after writing a simple fibonacci application I cant seem to get it building or running with wasix.
❯ cargo wasix run
error: couldn't read +wasix: No such file or directory (os error 2)
error: aborting due to previous error
error: Could not execute rustc
Caused by:
failed to execute "rustc" "+wasix" "--print" "sysroot"
status: exit status: 1
This is happening on macOS Ventura 13.5.1 on an M1 Max
Currently many common crates are not compatible with WASIX and require forks to work properly.
This results in a very suboptimal user experience.
cargo wasix
should check for the presence of such dependencies in Cargo.lock
, and either apply automatic fixes or inform the user.
This should apply to cargo wasix {check,build,run}
.
cargo wasix {check,build,run}
should:
Cargo.lock
has been generatedCargo.lock
for well-known incompatible crates[patch.crates-io]
section with the appropriate patchescrate XXX is not compatible with WASIX yet
Care must be taken to pick branches that match the semver constraints for the patches, otherwise the patch will just be silently ignored.
A good example is the WASIX Axum example found here: http://wasix.org/docs/language-guide/rust/tutorials/wasix-axum
It requires the below Cargo.toml to work properly:
[package]
name = "wasix-axum"
version = "0.1.0"
edition = "2021"
[dependencies]
axum = { version = "=0.6.9", features = ["tokio"] } # ← Updated Line
tokio = { version = "=1.24.2", default-features = false, features = ["full"] } # ← Updated Line
parking_lot = { version = "=0.12.1", features = ["nightly"] } # ← Added Line
[patch.crates-io]
socket2 = { git = "https://github.com/wasix-org/socket2.git", branch = "v0.4.7" } # ← Added Line
libc = { git = "https://github.com/wasix-org/libc.git" } # ← Added Line
tokio = { git = "https://github.com/wasix-org/tokio.git", branch = "wasix-1.24.2" }
Unable to use on Intel based Mac.
cargo wasix build --release
Finding latest release... (https://api.github.com/repos/wasix-org/rust/releases/latest)...
Could not download pre-built toolchain: Release v2023-05-26.1 does not have a prebuilt toolchain for host x86_64-apple-darwin
error: Download of pre-built toolchain failed
$ cargo wasix build
error: failed to create process "rustup" "toolchain" "list" "--verbose"
Caused by:
No such file or directory (os error 2)
This is annoying for NixOS users since we typically don't use rustup
for managing the Rust toolchain but Nix instead. What should happen instead is that cargo-wasix
should try to build, and if it fails to build display a helpful message instead of checking if the toolchain is available beforehand. Message can be something like this:
Toolchain not found, make sure to install it
Platform/OS: Apple Silicon, Macos Sonoma 14.0
cargo install cargo-wasix
cargo new --bin wasix-test
cargo wasix build
Hello!
I was looking to try out the cargo-wasix cli since WASIX is exactly what I have been waiting for, but it looks like whenever i go to build/test/run using cargo wasix build
or cargo wasix run
, i get this error:
❯ cargo wasix build
Finding latest release... (https://api.github.com/repos/wasix-org/rust/releases/latest)...
Could not download pre-built toolchain: Could not download release info
Caused by:
HTTP status client error (401 Unauthorized) for url (https://api.github.com/repos/wasix-org/rust/releases/latest)
error: Download of pre-built toolchain failed
Caused by:
Could not download release info
Caused by:
HTTP status client error (401 Unauthorized) for url (https://api.github.com/repos/wasix-org/rust/releases/latest)
I tried manually linking the toolchain as well, but that wasn't working out so well.
What can I do to work around this issue or help solve it? Thank you for any help in advance.
The automatic dependency validatoin added in #21 currently does not work in workspaces.
It fails with a metadata related error.
We need to change the implementation to properly support workspaces.
While my code successfully compiles under ordinary targets (package: citadel_pqcrypto), running cargo wasix test --package citadel_pqcrypto
fails with: error: Unable to compile "/Users/nologik/avarok/Citadel-Protocol/target/wasm32-wasmer-wasi/debug/deps/primary-0e896da8cb2e0eac.wasm" ╰─▶ 1: Compilation error: Code for function is too large
I thought that maybe running wasmer run --enable-all /Users/nologik/avarok/Citadel-Protocol/target/wasm32-wasmer-wasi/debug/deps/primary-0e896da8cb2e0eac.wasm
would solve the problem by enabling larger memory, however, it did not (I get the same error as above). How can I work around this?
Currently the CI tests only run on Linux.
We need to also run them on Windows and Mac OS (both aarch and x86).
Make a release file in the CI to autopublish artifacts and release on Crates.io
Hello! I am using Windows 11 and am facing this problem.
> cargo wasix check
Finding latest release... (https://api.github.com/repos/wasix-org/rust/releases/latest)...
Could not download pre-built toolchain: Release v2023-07-21.1 does not have a prebuilt toolchain for host x86_64-pc-windows-msvc
error: Download of pre-built toolchain failed
Caused by:
Release v2023-07-21.1 does not have a prebuilt toolchain for host x86_64-pc-windows-msvc
If the toolchain is installed and the directory where it's installed is later removed, cargo-wasix fails to detect the missing toolchain and fails instead.
Steps to reproduce:
mv /home/arshia/.local/share/cargo-wasix/toolchains/x86_64-unknown-linux-gnu_v2023-07-21.1/rust /home/arshia/.local/share/cargo-wasix/toolchains/x86_64-unknown-linux-gnu_v2023-07-21.1/rust-backup
rustup toolchain list
. The wasix
toolchain will still be listed.rustup default wasix
. Rustup will complain that the toolchain is not installed.cargo wasix build
. It will fail to detect the missing toolchain and report an error instead:$ cargo wasix build
error: toolchain 'wasix' is not installed
error: Could not execute rustc
Caused by:
failed to execute "rustc" "+wasix" "--print" "sysroot"
status: exit status: 1
Expected behaviour:
cargo-wasix
should detect the missing/invalid toolchain and download it again.
Upon load testing the application the application thread panics as below:
picasso@picasso:~/Desktop/src/projects/wasm/wasix-rust-examples/wasix-axum$ wasmer run target/wasm32-wasmer-wasi/debug/wasix-axum.wasm --net --enable-threads --env PORT=8080
Listening on http://127.0.0.1:8080
thread 'main' panicked at /home/picasso/.cargo/registry/src/index.crates.io-6f17d22bba15001f/parking_lot_core-0.9.8/src/thread_parker/wasm_atomic.rs:51:13:
assertion failed: r == 0 || r == 1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: RuntimeError: unreachable
at __rust_start_panic (<module>[9542]:0x9c5e94)
at rust_panic (<module>[1904]:0x6daaa8)
at std::panicking::rust_panic_with_hook::hfdfcaa6e69ebc719 (<module>[391]:0x3f5bdb)
at std::panicking::begin_panic_handler::{{closure}}::h3f7789fd24ed3f08 (<module>[3741]:0x826189)
at std::sys_common::backtrace::__rust_end_short_backtrace::hbe7fbe04baf16200 (<module>[9479]:0x9c4caf)
at rust_begin_unwind (<module>[5666]:0x8ef2a4)
at core::panicking::panic_fmt::h07835762205d9da6 (<module>[7816]:0x97fdc9)
at core::panicking::panic::h18678cb124bcc731 (<module>[6962]:0x94ea04)
at <parking_lot_core::thread_parker::imp::ThreadParker as parking_lot_core::thread_parker::ThreadParkerT>::park::h239fcb653d5e8208 (<module>[1990]:0x6eff0d)
at parking_lot_core::parking_lot::park::{{closure}}::h747f8f4c6ffb9884 (<module>[117]:0x25927a)
at parking_lot_core::parking_lot::park::h0c82da8664c01e84 (<module>[1006]:0x5b82c7)
at parking_lot::condvar::Condvar::wait_until_internal::h14feacfd5e810820 (<module>[815]:0x54f5bd)
at parking_lot::condvar::Condvar::wait::h46b42241deee20ee (<module>[4998]:0x8b404b)
at tokio::loom::std::parking_lot::Condvar::wait::h5886f82229a2d832 (<module>[4795]:0x8a0e07)
at tokio::park::thread::Inner::park::h13d6871b9cf36ff9 (<module>[329]:0x3b1764)
at <tokio::park::thread::CachedParkThread as tokio::park::Park>::park::{{closure}}::h074b229273ffab5b (<module>[7480]:0x971b6c)
at tokio::park::thread::CachedParkThread::with_current::{{closure}}::he9760f52961154e1 (<module>[7116]:0x95a3f0)
at std::thread::local::LocalKey<T>::try_with::hd1d2223d0d96b4d4 (<module>[1764]:0x6b8615)
at tokio::park::thread::CachedParkThread::with_current::hd43a4cfda3f350a4 (<module>[5388]:0x8d7a29)
at <tokio::park::thread::CachedParkThread as tokio::park::Park>::park::h69abcd569cf15580 (<module>[3223]:0x7e1ca7)
at tokio::park::thread::CachedParkThread::block_on::h66d5e8981ec1b1db (<module>[697]:0x508d16)
at tokio::runtime::enter::Enter::block_on::h9c87833c42353e15 (<module>[5418]:0x8da492)
at tokio::runtime::thread_pool::ThreadPool::block_on::h165f604ff938f099 (<module>[3650]:0x819f00)
at tokio::runtime::Runtime::block_on::h23f1bdae2f89888e (<module>[2530]:0x76305f)
at wasix_axum::main::h17aa3b46cb99d6f2 (<module>[2144]:0x713075)
at core::ops::function::FnOnce::call_once::ha9b2c8eb2ddd4496 (<module>[7844]:0x981660)
at std::sys_common::backtrace::__rust_begin_short_backtrace::h311b36d1bc0c7f41 (<module>[7926]:0x987e9a)
at std::rt::lang_start::{{closure}}::h55a3403b35cc2a28 (<module>[5827]:0x8ff999)
at std::rt::lang_start_internal::h9f91ddae2fba41c4 (<module>[5810]:0x8fe1ba)
at std::rt::lang_start::h3abfa2c193587021 (<module>[4130]:0x85942e)
at __main_void (<module>[8977]:0x9b985a)
at _start (<module>[8636]:0x9b41d6)
╰─▶ 1: RuntimeError: unreachable
at __rust_start_panic (<module>[9542]:0x9c5e94)
at rust_panic (<module>[1904]:0x6daaa8)
at std::panicking::rust_panic_with_hook::hfdfcaa6e69ebc719 (<module>[391]:0x3f5bdb)
at std::panicking::begin_panic_handler::{{closure}}::h3f7789fd24ed3f08 (<module>[3741]:0x826189)
at std::sys_common::backtrace::__rust_end_short_backtrace::hbe7fbe04baf16200 (<module>[9479]:0x9c4caf)
at rust_begin_unwind (<module>[5666]:0x8ef2a4)
at core::panicking::panic_fmt::h07835762205d9da6 (<module>[7816]:0x97fdc9)
at core::panicking::panic::h18678cb124bcc731 (<module>[6962]:0x94ea04)
at <parking_lot_core::thread_parker::imp::ThreadParker as parking_lot_core::thread_parker::ThreadParkerT>::park::h239fcb653d5e8208 (<module>[1990]:0x6eff0d)
at parking_lot_core::parking_lot::park::{{closure}}::h747f8f4c6ffb9884 (<module>[117]:0x25927a)
at parking_lot_core::parking_lot::park::h0c82da8664c01e84 (<module>[1006]:0x5b82c7)
at parking_lot::condvar::Condvar::wait_until_internal::h14feacfd5e810820 (<module>[815]:0x54f5bd)
at parking_lot::condvar::Condvar::wait::h46b42241deee20ee (<module>[4998]:0x8b404b)
at tokio::loom::std::parking_lot::Condvar::wait::h5886f82229a2d832 (<module>[4795]:0x8a0e07)
at tokio::park::thread::Inner::park::h13d6871b9cf36ff9 (<module>[329]:0x3b1764)
at <tokio::park::thread::CachedParkThread as tokio::park::Park>::park::{{closure}}::h074b229273ffab5b (<module>[7480]:0x971b6c)
at tokio::park::thread::CachedParkThread::with_current::{{closure}}::he9760f52961154e1 (<module>[7116]:0x95a3f0)
at std::thread::local::LocalKey<T>::try_with::hd1d2223d0d96b4d4 (<module>[1764]:0x6b8615)
at tokio::park::thread::CachedParkThread::with_current::hd43a4cfda3f350a4 (<module>[5388]:0x8d7a29)
at <tokio::park::thread::CachedParkThread as tokio::park::Park>::park::h69abcd569cf15580 (<module>[3223]:0x7e1ca7)
at tokio::park::thread::CachedParkThread::block_on::h66d5e8981ec1b1db (<module>[697]:0x508d16)
at tokio::runtime::enter::Enter::block_on::h9c87833c42353e15 (<module>[5418]:0x8da492)
at tokio::runtime::thread_pool::ThreadPool::block_on::h165f604ff938f099 (<module>[3650]:0x819f00)
at tokio::runtime::Runtime::block_on::h23f1bdae2f89888e (<module>[2530]:0x76305f)
at wasix_axum::main::h17aa3b46cb99d6f2 (<module>[2144]:0x713075)
at core::ops::function::FnOnce::call_once::ha9b2c8eb2ddd4496 (<module>[7844]:0x981660)
at std::sys_common::backtrace::__rust_begin_short_backtrace::h311b36d1bc0c7f41 (<module>[7926]:0x987e9a)
at std::rt::lang_start::{{closure}}::h55a3403b35cc2a28 (<module>[5827]:0x8ff999)
at std::rt::lang_start_internal::h9f91ddae2fba41c4 (<module>[5810]:0x8fe1ba)
at std::rt::lang_start::h3abfa2c193587021 (<module>[4130]:0x85942e)
at __main_void (<module>[8977]:0x9b985a)
at _start (<module>[8636]:0x9b41d6)
The first 1,000 requests load test past well but after changing the requests to 10,000 it failed after almost 2,800 requests as shown below:
1,000 requests
$ bombardier -c 2 -n 1000 http://localhost:8080
Bombarding http://localhost:8080 with 1000 request(s) using 2 connection(s)
1000 / 1000 [=====================================================================================================================================================================] 100.00% 43/s 22s
Done!
Statistics Avg Stdev Max
Reqs/sec 44.36 30.88 117.87
Latency 45.05ms 1.44ms 51.13ms
HTTP codes:
1xx - 0, 2xx - 1000, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 8.83KB/s
10,000 requests
$ bombardier -c 4 -n 10000 http://localhost:8080
Bombarding http://localhost:8080 with 10000 request(s) using 4 connection(s)
10000 / 10000 [==================================================================================================================================================================] 100.00% 316/s 31s
Done!
Statistics Avg Stdev Max
Reqs/sec 320.87 2950.83 45532.62
Latency 12.61ms 9.93ms 52.27ms
HTTP codes:
1xx - 0, 2xx - 2801, 3xx - 0, 4xx - 0, 5xx - 0
others - 7199
Errors:
dial tcp 127.0.0.1:8080: connect: connection refused - 7199
Throughput: 17.69KB/s
Development environment:
cargo wasix build
fails with error 'cargo' is not installed for the toolchain 'wasix'
.
Should build successfully.
# Dockerfile
FROM rust:1.70-bookworm
WORKDIR /src
RUN cargo init
RUN cargo install cargo-wasix
RUN cargo wasix build
$ docker build -t cargo-wasix-test:latest .
[+] Building 73.1s (8/8) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 143B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/rust:1.70-bookworm 1.5s
=> CACHED [1/5] FROM docker.io/library/rust:1.70-bookworm@sha256:79ca6896ecfe3787599bba6fd9dcd98b28f2742396df96a5b33f737ca7749730 0.0s
=> [2/5] WORKDIR /src 0.0s
=> [3/5] RUN cargo init 1.0s
=> [4/5] RUN cargo install cargo-wasix 26.7s
=> ERROR [5/5] RUN cargo wasix build 43.8s
------
> [5/5] RUN cargo wasix build:
#0 0.494 Finding latest release... (https://api.github.com/repos/wasix-org/rust/releases/latest)...
#0 0.844 Downloading sysroot from url 'https://github.com/wasix-org/rust/releases/download/v2023-05-26.1/wasix-libc.tar.gz'...
#0 1.417 Extracting...
#0 1.555 Downloading Rust toolchain from url 'https://github.com/wasix-org/rust/releases/download/v2023-05-26.1/rust-toolchain-x86_64-unknown-linux-gnu.tar.gz'...
#0 2.118 Extracting...
#0 40.61 Downloaded toolchain x86_64-unknown-linux-gnu to /root/.local/share/cargo-wasix/toolchains/x86_64-unknown-linux-gnu_v2023-05-26.1/rust
#0 40.61 Activating rustup toolchain wasix at /root/.local/share/cargo-wasix/toolchains/x86_64-unknown-linux-gnu_v2023-05-26.1/rust...
#0 40.62 Running rustup toolchain link wasix /root/.local/share/cargo-wasix/toolchains/x86_64-unknown-linux-gnu_v2023-05-26.1/rust:
#0 40.62 rustup toolchain wasix was linked and is now available!
#0 40.72 error: 'cargo' is not installed for the toolchain 'wasix'
#0 40.72 note: this is a custom toolchain, which cannot use `rustup component add`
#0 40.72 help: if you built this toolchain from source, and used `rustup toolchain link`, then you may be able to build the component with `x.py`
------
Dockerfile:7
--------------------
5 | RUN cargo init
6 | RUN cargo install cargo-wasix
7 | >>> RUN cargo wasix build
8 |
--------------------
ERROR: failed to solve: process "/bin/sh -c cargo wasix build" did not complete successfully: exit code: 1
wasix
target is not available in rustup
after installing cargo-wasix
.
As mention in this issue. cargo-wasix
runs the program with the version of wasmer available on the system and doesn't checks what minimum compatible version should be there.
For all specific examples across wasix and edge. cargo-wasix
should mention that, "User needs wasmer 4.1"
cargo-wasi
is being archived, so users need a replacement.
cargo-wasix
could be what we should use and recommend instead. But it currently requires/install the wasix-libc
as well as an old Rust toolchain. This may not be desirable, and is an issue for packaging.
Would it be reasonable to only download the wasix
components when actually compiling to wasix
? And maybe provide a cargo wasi
command for people who need a maintained version of cargo wasi
?
Decompression of the toolchain after downloading is really slow.
Might have to:
Attempting to install the toolchain on a very slow (KB/s) hangs on Extracting...
but I believe that message is printed too early, while the download is progressing still:
Lines 602 to 612 in 07d5637
Some minimal progress bar would be great, but at least ensuring that it is clear what is blocking the install step-wise would be a very nice fix to have.
# Run in a rust crate:
cargo wasix build
Finding latest release... (https://api.github.com/repos/wasix-org/rust/releases/latest)...
Toolchain path ~/.local/share/cargo-wasix/toolchains/x86_64-unknown-linux-gnu_v2023-11-01.1 already exists - deleting existing files!
Downloading sysroot from url 'https://github.com/wasix-org/rust/releases/download/v2023-11-01.1/wasix-libc.tar.gz'...
Extracting...
Downloading Rust toolchain from url 'https://github.com/wasix-org/rust/releases/download/v2023-11-01.1/rust-toolchain-x86_64-unknown-linux-gnu.tar.gz'...
Extracting...
# hangs for ~1 minute or more here
Downloaded toolchain x86_64-unknown-linux-gnu to /home/nuke/.local/share/cargo-wasix/toolchains/x86_64-unknown-linux-gnu_v2023-11-01.1/rust
Activating rustup toolchain wasix at /home/nuke/.local/share/cargo-wasix/toolchains/x86_64-unknown-linux-gnu_v2023-11-01.1/rust...
Running rustup toolchain link wasix /home/nuke/.local/share/cargo-wasix/toolchains/x86_64-unknown-linux-gnu_v2023-11-01.1/rust:
rustup toolchain wasix was linked and is now available!
Currently, the wasix toolchain is not updated.
The only way to update is to manually delete the rustup wasix
toolchain directory.
Need to add a command to make that possible.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.