wasix-org / cargo-wasix

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

cargo-wasix does not work when the toolchain is installed in a deleted directory #30

Open Arshia001 opened 1 year ago

Arshia001 commented 1 year ago

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:

  1. Remove or rename the toolchain directory: 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
  2. Run rustup toolchain list. The wasix toolchain will still be listed.
  3. Run rustup default wasix. Rustup will complain that the toolchain is not installed.
  4. Run 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.