wasix-org / cargo-wasix

Cargo wrapper for working with Webassembly wasi(x).
Apache License 2.0
54 stars 10 forks source link

'cargo' is not installed for the toolchain 'wasix' #12

Open bcheidemann opened 1 year ago

bcheidemann commented 1 year ago

Outcome

cargo wasix build fails with error 'cargo' is not installed for the toolchain 'wasix'.

Expected Result

Should build successfully.

Replication Steps

# 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
theduke commented 1 year ago

Mhm, interesting.

My hunch would be this being related to the rustup setup, as in: the PATH not prioritizing the rustup provided wrappers.

theduke commented 1 year ago

This works fine:

FROM archlinux

RUN pacman -Syu rustup openssl base-devel
RUN rustup default stable
RUN cargo install cargo-wasix
RUN cargo new wasixhello && cd wasixhello && cargo wasix build