cargo-msrv icon indicating copy to clipboard operation
cargo-msrv copied to clipboard

Unable to install toolchain with `rustup install`

Open jonhoo opened this issue 2 years ago • 6 comments

For some reason, cargo-msrv now refuses to run in any project on my computer:

$ cargo new foobar
     Created binary (application) `foobar` package
$ cd foobar/
$ cargo msrv
Fetching index
Determining the Minimum Supported Rust Version (MSRV) for toolchain x86_64-unknown-linux-gnu
Using check command cargo check --all
Unable to install toolchain with `rustup install 1.56.1-x86_64-unknown-linux-gnu`.
$ cargo msrv --bisect
Fetching index
Determining the Minimum Supported Rust Version (MSRV) for toolchain x86_64-unknown-linux-gnu
Using check command cargo check --all
Unable to install toolchain with `rustup install 1.56.1-x86_64-unknown-linux-gnu`.

This happens both when installing the latest released version of cargo-msrv, and installing directly from the main branch.

This is particularly weird because when I run the listed command myself, it works without issue:

$ rustup install 1.56.1-x86_64-unknown-linux-gnu
info: syncing channel updates for '1.56.1-x86_64-unknown-linux-gnu'
info: latest update on 2021-11-01, rust version 1.56.1 (59eed8a2a 2021-11-01)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
 52.9 MiB /  52.9 MiB (100 %)  23.9 MiB/s in  2s ETA:  0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 17.3 MiB /  17.3 MiB (100 %)  11.5 MiB/s in  1s ETA:  0s
info: installing component 'rust-std'
 23.5 MiB /  23.5 MiB (100 %)  14.3 MiB/s in  1s ETA:  0s
info: installing component 'rustc'
 52.9 MiB /  52.9 MiB (100 %)  16.0 MiB/s in  3s ETA:  0s
info: installing component 'rustfmt'

  1.56.1-x86_64-unknown-linux-gnu installed - rustc 1.56.1 (59eed8a2a 2021-11-01)

$ rustup toolchain list
stable-x86_64-unknown-linux-gnu (default)
beta-x86_64-unknown-linux-gnu
nightly-2020-02-28-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu
1.31.1-x86_64-unknown-linux-gnu
1.32.0-x86_64-unknown-linux-gnu
1.34.0-x86_64-unknown-linux-gnu
1.35.0-x86_64-unknown-linux-gnu
1.36.0-x86_64-unknown-linux-gnu
1.38.0-x86_64-unknown-linux-gnu
1.40.0-x86_64-unknown-linux-gnu
1.42.0-x86_64-unknown-linux-gnu
1.48.0-x86_64-unknown-linux-gnu
1.56.1-x86_64-unknown-linux-gnu
$ cargo +1.56.1 check --all
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s

System info:

$ uname -a
Linux xpanse 5.14.16-arch1-1 #1 SMP PREEMPT Tue, 02 Nov 2021 22:22:59 +0000 x86_64 GNU/Linux
$ cat /etc/issue
Arch Linux \r (\l)
$ rustup --version
rustup 1.24.3 (2021-06-08)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.56.1 (59eed8a2a 2021-11-01)`

jonhoo avatar Nov 06 '21 19:11 jonhoo

Thanks for the detailed report! I've tried to reproduce this issue but was unable to.

  • What is your current cargo-msrv version?: cargo msrv --version
  • Do you have an idea what the last working cargo-msrv version was (or possibly the last time you used it and it worked, date wise)?
    • Possibly, cargo-msrv 0.10.0 which was released about a month ago might work for you as an intermediate solution: `cargo install cargo-msrv --version "0.10.0"

foresterre avatar Nov 08 '21 22:11 foresterre

Yeah, it's weird, I only have this issue on this computer.

$ cargo msrv --version
cargo-msrv 0.12.0
$ cargo install cargo-msrv --version 0.10.0
$ cargo msrv
# same error as before

However, I did discover that, weirdly enough,

$ cargo-msrv msrv

work just fine! It's just when invoked through Cargo that it fails.

Digging some deeper, I do have CARGO_TARGET_DIR set, and I have $CARGO_TARGET_DIR/bin on my path, so:

$ which -a cargo-msrv
/home/jon/.cargo/bin/cargo-msrv
/home/jon/.cargo-target/release/cargo-msrv

If I execute either of those directly (with the argument msrv) they both work though, so that seems unrelated.

I don't know why executing through cargo would make a difference here. It does mean it'll run through Rustup (whereas it won't when run directly as cargo-msrv), which might change the execution environment (e.g., RUSTUP_HOME and RUSTUP_TOOLCHAIN will be set when invoked through cargo).

jonhoo avatar Nov 09 '21 16:11 jonhoo

It seems that I have the same error on aarch:

$ cargo msrv --version
cargo-msrv 0.15.1
$ cargo msrv
Fetching index
Determining the Minimum Supported Rust Version (MSRV) for toolchain aarch64-apple-darwin
Using check command cargo check
Unable to install toolchain with `rustup install 1.33.0-aarch64-apple-darwin`.

It is due to the fact that the target didn't existed on the channel before: https://github.com/rust-lang/rustup/issues/2413

If I check for this particular version in the static s3 index with:

aws --no-sign-request s3 ls static-rust-lang-org/dist/ |rg '1\.33\.0-aarch64-apple-darwin'

It finds nothing.

I think it is link to the fact that msrv is checking the version without checking if the target was supported.

Here we can see that for edition = 2018 it is minimum 1.31.0. But target aarch64-apple-darwin is supported only for 1.49.0.

I also think that the subcrate rust-releases and msrv are testing for macos through github action runner macos-stable which is a darwin x86_64 or i686 not an aarch64.

If we run the same command but targeting x86_64 we find the expected version.

aws --no-sign-request s3 ls static-rust-lang-org/dist/ |rg '1\.33\.0-x86_64-apple-darwin'

I think a fix would be to pass the target when searching for the latest_stable version.

Freyskeyd avatar Apr 05 '23 10:04 Freyskeyd

Hi @Freyskeyd, thanks for the detailed report!

I'm currently working on implementing this for the next release. With a bit of luck, it may also help towards fixing #587.

foresterre avatar Apr 06 '23 16:04 foresterre

I have the same problem on Mac.

As a workaround, this worked for me:

docker run --platform=linux/amd64 -t -v "$(pwd)/Cargo.toml":/app/Cargo.toml foresterre/cargo-msrv

Although it actually doesn't work because

  [Meta]   cargo-msrv 0.16.0-beta.18                                                                                                                                                                        

Compatibility Check #1: Rust 1.37.0
  [FAIL]   Is incompatible 
                                                        
  ╭────────────────────────────────────────────────────╮
  │ error: failed to read `/app/crates/api/Cargo.toml` │
  │                                                    │
  │ Caused by:                                         │
  │   No such file or directory (os error 2)           │
  │                                                    │
  ╰────────────────────────────────────────────────────╯
                                                        

Compatibility Check #2: Rust 1.56.1                                                                                                                                                                         
  [FAIL]   Is incompatible 
                                                                                                                                                           
  ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
  │ error: failed to parse manifest at `/app/Cargo.toml`                                                                                                  │
  │                                                                                                                                                       │
  │ Caused by:                                                                                                                                            │
  │   feature `strip` is required                                                                                                                         │
  │                                                                                                                                                       │
  │   The package requires the Cargo feature called `strip`, but that feature is not stabilized in this version of Cargo (1.56.0 (4ed5d137b 2021-10-04)). │
  │   Consider trying a newer version of Cargo (this may require the nightly release).                                                                    │
  │   See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#profile-strip-option for more information about the status of this feature.     │
  │                                                                                                                                                       │
  ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
                                                                                                                                                           

Compatibility Check #3: Rust 1.66.1                                                                                                                                                                         
  [FAIL]   Is incompatible 
                                                                           
  ╭───────────────────────────────────────────────────────────────────────╮
  │ error: failed to load manifest for workspace member `/app/crates/api` │
  │                                                                       │
  │ Caused by:                                                            │
  │   failed to read `/app/crates/api/Cargo.toml`                         │
  │                                                                       │
  │ Caused by:                                                            │
  │   No such file or directory (os error 2)                              │
  │                                                                       │
  ╰───────────────────────────────────────────────────────────────────────╯
                                                                           

Compatibility Check #4: Rust 1.71.1                                                                                                                                                                         
  [FAIL]   Is incompatible 
                                                                           
  ╭───────────────────────────────────────────────────────────────────────╮
  │ error: failed to load manifest for workspace member `/app/crates/api` │
  │                                                                       │
  │ Caused by:                                                            │
  │   failed to read `/app/crates/api/Cargo.toml`                         │
  │                                                                       │
  │ Caused by:                                                            │
  │   No such file or directory (os error 2)                              │
  │                                                                       │
  ╰───────────────────────────────────────────────────────────────────────╯
                                                                           

Compatibility Check #5: Rust 1.73.0                                                                                                                                                                         
  [FAIL]   Is incompatible 
                                                                           
  ╭───────────────────────────────────────────────────────────────────────╮
  │ error: failed to load manifest for workspace member `/app/crates/api` │
  │                                                                       │
  │ Caused by:                                                            │
  │   failed to read `/app/crates/api/Cargo.toml`                         │
  │                                                                       │
  │ Caused by:                                                            │
  │   No such file or directory (os error 2)                              │
  │                                                                       │
  ╰───────────────────────────────────────────────────────────────────────╯
                                                                           

Compatibility Check #6: Rust 1.74.1                                                                                                                                                                         
  [FAIL]   Is incompatible 
                                                                           
  ╭───────────────────────────────────────────────────────────────────────╮
  │ error: failed to load manifest for workspace member `/app/crates/api` │
  │                                                                       │
  │ Caused by:                                                            │
  │   failed to read `/app/crates/api/Cargo.toml`                         │
  │                                                                       │
  │ Caused by:                                                            │
  │   No such file or directory (os error 2)                              │
  │                                                                       │
  ╰───────────────────────────────────────────────────────────────────────╯
                                                                           

Compatibility Check #7: Rust 1.75.0                                                                                                                                                                         
  [FAIL]   Is incompatible 
                                                                           
  ╭───────────────────────────────────────────────────────────────────────╮
  │ error: failed to load manifest for workspace member `/app/crates/api` │
  │                                                                       │
  │ Caused by:                                                            │
  │   failed to read `/app/crates/api/Cargo.toml`                         │
  │                                                                       │
  │ Caused by:                                                            │
  │   No such file or directory (os error 2)                              │
  │                                                                       │
  ╰───────────────────────────────────────────────────────────────────────╯
                                                                           

Result:
   Considered (min … max):   Rust 0.11.0 … Rust 1.75.0 
   Search method:            bisect                    
   MSRV:                     N/A                       
   Target:                   x86_64-unknown-linux-gnu  
                                                                                                                                                                                                            

Unable to find a Minimum Supported Rust Version (MSRV).

If you think this result is erroneous, please run: `cargo check --target x86_64-unknown-linux-gnu` manually.

If the above does succeed, or you think cargo-msrv errored in another way, please feel free to
report the issue at: https://github.com/foresterre/cargo-msrv/issues

Thank you in advance!

Although it's werid that the workspace manifest did work.

arifd avatar Jan 01 '24 10:01 arifd

I have the same problem on Mac.

As a workaround, this worked for me:

docker run --platform=linux/amd64 -t -v "$(pwd)/Cargo.toml":/app/Cargo.toml foresterre/cargo-msrv

Although it actually doesn't work because

  [Meta]   cargo-msrv 0.16.0-beta.18                                                                                                                                                                        

Compatibility Check #1: Rust 1.37.0
  [FAIL]   Is incompatible 
                                                        
  ╭────────────────────────────────────────────────────╮
  │ error: failed to read `/app/crates/api/Cargo.toml` │
  │                                                    │
  │ Caused by:                                         │
  │   No such file or directory (os error 2)           │
  │                                                    │
  ╰────────────────────────────────────────────────────╯
                                                        

Compatibility Check #2: Rust 1.56.1                                                                                                                                                                         
  [FAIL]   Is incompatible 
                                                                                                                                                           
  ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
  │ error: failed to parse manifest at `/app/Cargo.toml`                                                                                                  │
  │                                                                                                                                                       │
  │ Caused by:                                                                                                                                            │
  │   feature `strip` is required                                                                                                                         │
  │                                                                                                                                                       │
  │   The package requires the Cargo feature called `strip`, but that feature is not stabilized in this version of Cargo (1.56.0 (4ed5d137b 2021-10-04)). │
  │   Consider trying a newer version of Cargo (this may require the nightly release).                                                                    │
  │   See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#profile-strip-option for more information about the status of this feature.     │
  │                                                                                                                                                       │
  ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
                                                                                                                                                           

Compatibility Check #3: Rust 1.66.1                                                                                                                                                                         
  [FAIL]   Is incompatible 
                                                                           
  ╭───────────────────────────────────────────────────────────────────────╮
  │ error: failed to load manifest for workspace member `/app/crates/api` │
  │                                                                       │
  │ Caused by:                                                            │
  │   failed to read `/app/crates/api/Cargo.toml`                         │
  │                                                                       │
  │ Caused by:                                                            │
  │   No such file or directory (os error 2)                              │
  │                                                                       │
  ╰───────────────────────────────────────────────────────────────────────╯
                                                                           

Compatibility Check #4: Rust 1.71.1                                                                                                                                                                         
  [FAIL]   Is incompatible 
                                                                           
  ╭───────────────────────────────────────────────────────────────────────╮
  │ error: failed to load manifest for workspace member `/app/crates/api` │
  │                                                                       │
  │ Caused by:                                                            │
  │   failed to read `/app/crates/api/Cargo.toml`                         │
  │                                                                       │
  │ Caused by:                                                            │
  │   No such file or directory (os error 2)                              │
  │                                                                       │
  ╰───────────────────────────────────────────────────────────────────────╯
                                                                           

Compatibility Check #5: Rust 1.73.0                                                                                                                                                                         
  [FAIL]   Is incompatible 
                                                                           
  ╭───────────────────────────────────────────────────────────────────────╮
  │ error: failed to load manifest for workspace member `/app/crates/api` │
  │                                                                       │
  │ Caused by:                                                            │
  │   failed to read `/app/crates/api/Cargo.toml`                         │
  │                                                                       │
  │ Caused by:                                                            │
  │   No such file or directory (os error 2)                              │
  │                                                                       │
  ╰───────────────────────────────────────────────────────────────────────╯
                                                                           

Compatibility Check #6: Rust 1.74.1                                                                                                                                                                         
  [FAIL]   Is incompatible 
                                                                           
  ╭───────────────────────────────────────────────────────────────────────╮
  │ error: failed to load manifest for workspace member `/app/crates/api` │
  │                                                                       │
  │ Caused by:                                                            │
  │   failed to read `/app/crates/api/Cargo.toml`                         │
  │                                                                       │
  │ Caused by:                                                            │
  │   No such file or directory (os error 2)                              │
  │                                                                       │
  ╰───────────────────────────────────────────────────────────────────────╯
                                                                           

Compatibility Check #7: Rust 1.75.0                                                                                                                                                                         
  [FAIL]   Is incompatible 
                                                                           
  ╭───────────────────────────────────────────────────────────────────────╮
  │ error: failed to load manifest for workspace member `/app/crates/api` │
  │                                                                       │
  │ Caused by:                                                            │
  │   failed to read `/app/crates/api/Cargo.toml`                         │
  │                                                                       │
  │ Caused by:                                                            │
  │   No such file or directory (os error 2)                              │
  │                                                                       │
  ╰───────────────────────────────────────────────────────────────────────╯
                                                                           

Result:
   Considered (min … max):   Rust 0.11.0 … Rust 1.75.0 
   Search method:            bisect                    
   MSRV:                     N/A                       
   Target:                   x86_64-unknown-linux-gnu  
                                                                                                                                                                                                            

Unable to find a Minimum Supported Rust Version (MSRV).

If you think this result is erroneous, please run: `cargo check --target x86_64-unknown-linux-gnu` manually.

If the above does succeed, or you think cargo-msrv errored in another way, please feel free to
report the issue at: [https://github.com/foresterre/cargo-msrv/issues](https://github.com/foresterre/cargo-msrv/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc)

Thank you in advance!

Although it's werid that the workspace manifest did work.

I was not able to reproduce this. Could you please explain how I can reproduce this?

foresterre avatar Jan 12 '24 22:01 foresterre