wasix-org/cargo-wasix

cargo wasix build fails: could not execute rustc

jessbowers opened this issue · 6 comments

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

Trying to build the toolchain from scratch, I got another error:

 cargo wasix build-toolchain
...
...
libc-top-half/musl/src/conf/sysconf.c:264:38: error: incompatible pointer types passing 'unsigned long *' to parameter of type '__wasi_size_t *' (aka 'unsigned int *') [-Werror,-Wincompatible-pointer-types]
                        int r = __wasi_thread_parallelism(&n_cpus);
                                                          ^~~~~~~
/home/dev/.wasix/wasix-libc/sysroot/include/wasi/api_wasix.h:3448:20: note: passing argument to parameter 'retptr0' here
    __wasi_size_t *retptr0
                   ^
1 error generated.
make: *** [Makefile:569: build/wasm64-wasi/libc-top-half/musl/src/conf/sysconf.o] Error 1
make: *** Waiting for unfinished jobs....
error: could not build sysroot64

Caused by:
    failed to execute cd "/home/dev/.wasix/wasix-libc" && PATH="/home/dev/.wasix/llvm-15/bin:/home/dev/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" "bash" "./build64.sh"
        status: exit status: 2

@theduke can you try to reproduce it?

Note that using Debian 12 does not have this issue. I think it has to do with the version of GLIBC

I'm seeing the same issue:

OS: Ubuntu 20.04.6 LTS on Windows 10 x86_64
Kernel: 5.15.90.1-microsoft-standard-WSL2

> cargo --version
cargo 1.73.0-nightly (d78bbf4bd 2023-08-03) (but same issue happened with 1.68)

> rustc --version
rustc 1.73.0-nightly (28eb857b9 2023-08-12)

> cargo wasix --version
cargo-wasix 0.1.21

Updating to Ubuntu 22.04 resolved the issue

This is also an issue for me on Debian 11.