Rustup: Proposed command to install new toolchain is throwing an error

Created on 30 Jul 2020  ·  6Comments  ·  Source: rust-lang/rustup

I tried this command (in comit-network/comit-rs but I don't think it matters)

/Users/froyer/.cargo/bin/cargo build --color=always --bin cnd
error: process didn't exit successfully: `rustc -vV` (exit code: 1)
--- stderr
error: 'rustc' is not installed for the toolchain '1.45.0-x86_64-apple-darwin'
To install, run `rustup component add rustc --toolchain 1.45.0-x86_64-apple-darwin`

So I then followed the recommendation:

$ rustup component add rustc --toolchain 1.45.0-x86_64-apple-darwin
error: toolchain '1.45.0-x86_64-apple-darwin' does not support components

I would have expected the command to work and fix my problem, instead, it gave me the error above.

Of course, I was able to fix the issue by doing:

rustup toolchain add 1.45.0

Versions

▶ rustup --version
rustup 1.22.1 (b01adbbc3 2020-07-08)
bug

All 6 comments

That's interesting, I suppose the right thing there is to detect the toolchain is not present at all and to suggest a rustup toolchain install but I thought we auto-installed toolchains in general, so I wonder how you managed to get into this circumstance.

I imagine, given how long it has taken me to get to this issue, than you're not able to give me a rustup show for the dir you ran that in, with a similar setup? Are you able to reproduce this in another user on the same system?

I don't think I did any rust upgrade since the issue. However, I did run rustup toolchain add 1.45.0 in the directory where I had the issue.

Here is the current rustup show:

▶ rustup show
Default host: x86_64-apple-darwin
rustup home:  /Users/froyer/.rustup

installed toolchains
--------------------

stable-x86_64-apple-darwin (default)
beta-x86_64-apple-darwin
nightly-2020-01-15-x86_64-apple-darwin
nightly-2020-05-03-x86_64-apple-darwin
nightly-2020-08-13-x86_64-apple-darwin
nightly-x86_64-apple-darwin
1.22.0-x86_64-apple-darwin
1.41.1-x86_64-apple-darwin
1.42.0-x86_64-apple-darwin
1.43.0-x86_64-apple-darwin
1.44.0-x86_64-apple-darwin
1.45.0-x86_64-apple-darwin

active toolchain
----------------

1.45.0-x86_64-apple-darwin (overridden by '/Users/froyer/src/comit-network/comit-rs/rust-toolchain')
rustc 1.45.0 (5c1f21c3b 2020-07-13)

Let me see if I can reproduce and give a new rustup show.

Sorry, I was not able to reproduce by messing around with rustup ☹️

▶ rustup toolchain remove 1.45.0-x86_64-apple-darwin
info: uninstalling toolchain '1.45.0-x86_64-apple-darwin'
info: toolchain '1.45.0-x86_64-apple-darwin' uninstalled

▶ cargo build --color=always --bin cnd
info: syncing channel updates for '1.45.0-x86_64-apple-darwin'
info: latest update on 2020-07-16, rust version 1.45.0 (5c1f21c3b 2020-07-13)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: Defaulting to 500.0 MiB unpack ram
info: installing component 'clippy'
info: installing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
   Compiling syn v1.0.38
^C  

▶ rustup component remove rustc --toolchain 1.45.0-x86_64-apple-darwin
info: removing component 'rustc'

▶ cargo build --color=always --bin cnd
error: process didn't exit successfully: `rustc -vV` (exit code: 1)
--- stderr
error: 'rustc' is not installed for the toolchain '1.45.0-x86_64-apple-darwin'
To install, run `rustup component add rustc --toolchain 1.45.0-x86_64-apple-darwin`

▶ rustup component add rustc --toolchain 1.45.0-x86_64-apple-darwin
info: downloading component 'rustc'
info: installing component 'rustc'
info: Defaulting to 500.0 MiB unpack ram
 46.3 MiB /  46.3 MiB (100 %)  14.1 MiB/s in  3s ETA:  0s

That's very strange, I wonder if you somehow had a non-rustup cargo or somesuch available in your first case. In your recent comment you see rustup automatically installing the toolchain which is what I expected behaviour-wise, so I don't know how we might reproduce the situation.

If you ever encounter something like this again, please ensure you give us rustup show from before you try and fix things.

In the meantime, I'm going to leave this issue open and ask @rbtcollins if he thinks there's any situation which could have caused the initial problem.

We don't appear to have re-encountered this issue. I'm going to close it, but if it happens again, poke on here and we can reopen it.

Was this page helpful?
0 / 5 - 0 ratings