Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo is not applicable when using a toolchain specified in rust-toolchain.toml #3104

Open
Tracked by #3937
sophiajt opened this issue Nov 4, 2022 · 10 comments
Open
Tracked by #3937
Labels

Comments

@sophiajt
Copy link

sophiajt commented Nov 4, 2022

Problem

I'm experiencing an issue very similar to #3025

In Nushell, we currently use this in our rust-toolchain.toml:

[toolchain]
profile = "default"
channel = "1.64.0"

On my mac, this is now broken:

❯ cargo install --path . --features=extra
error: the 'cargo' binary, normally provided by the 'cargo' component, is not applicable to the '1.64.0-aarch64-apple-darwin' toolchain

Strangely enough, if I change channel = "1.64.0" to channel = "1.64" it fixes the issue but breaks other platforms. It almost seems like there's a naming issue that got published.

Steps

  1. Described above

Possible Solution(s)

It should be possible to use rust-toolchain.toml to request an earlier version of the Rust compiler using the full version number across platforms.

Notes

No response

Rustup version

rustup 1.25.1 (bb60b1e89 2022-07-12)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.64.0 (a55dd71d5 2022-09-19)`

Installed toolchains

rustup show
Default host: aarch64-apple-darwin
rustup home:  /Users/jt/.rustup

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

stable-aarch64-apple-darwin (default)
nightly-2022-01-20-aarch64-apple-darwin
nightly-2022-10-20-aarch64-apple-darwin
nightly-aarch64-apple-darwin
1.64-aarch64-apple-darwin
1.56.0-aarch64-apple-darwin
1.61.0-aarch64-apple-darwin
1.63.0-aarch64-apple-darwin
1.64.0-aarch64-apple-darwin

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

1.64.0-aarch64-apple-darwin (overridden by '/Users/jt/Source/nushell/rust-toolchain.toml')
rustc 1.64.0 (a55dd71d5 2022-09-19)
@sophiajt sophiajt added the bug label Nov 4, 2022
@joii2020
Copy link

I also encountered a similar problem, throughrustup uninstall nightly-aarch64-apple-darwin and rustup install nightly-aarch64-apple-darwin can solve the problem.
I guess because I need to switch between x86_64 and arm frequently, but CARGO_HOME uses the same.

@sambrightman
Copy link

Potentially some connection to #3061? Or at least the workaround seems connected.

@L-M-Sherlock
Copy link

Same problem:

info: syncing channel updates for '1.72-aarch64-apple-darwin'
info: latest update on 2023-08-24, rust version 1.72.0 (5680fa18f 2023-08-23)
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: installing component 'clippy'
info: installing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
error: the 'cargo' binary, normally provided by the 'cargo' component, is not applicable to the '1.72-aarch64-apple-darwin' toolchain

It occurs when channel = "1.72". I solved it via setting channel = "1.72.0".

@rbtcollins
Copy link
Contributor

rbtcollins commented Aug 28, 2023

It occurs when channel = "1.72". I solved it via setting channel = "1.72.0".

This may indicate a problem with the major.minor channel aliases. @pietroalbini I think you know about the setup of those? (If not, can you point me at the right place to enquire).

@ashsajal1
Copy link

Use stable-gnu toolchain.
rustup toolchain install stable-gnu

then
rustup default stable-x86_64-pc-windows-gnu

ref : https://rust-lang.github.io/rustup/installation/windows.html

@rami3l rami3l changed the title Cargo via rustup + rust-toolchain broken on macOS Cargo is not applicable to the 1.64.0 toolchain Jul 10, 2024
@rami3l
Copy link
Member

rami3l commented Jul 17, 2024

Looks like the problem is still there with the 1.79 channel (#3953)?

@jdno There shouldn't be a fundamental difference between the two manifests (1.79 and 1.79.0), right?

Update: Just tried on my own Mac and nothing happens:

> rustup --version
rustup 1.27.1+366 (4149df642 2024-07-15)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.79.0 (129f3b996 2024-06-10)`

> rustup toolchain install 1.79
info: syncing channel updates for '1.79-aarch64-apple-darwin'
info: latest update on 2024-06-13, rust version 1.79.0 (129f3b996 2024-06-10)
info: downloading component 'cargo'
  6.4 MiB /   6.4 MiB (100 %)   1.2 MiB/s in  7s         
info: downloading component 'clippy'
  2.2 MiB /   2.2 MiB (100 %) 622.8 KiB/s in  2s         
info: downloading component 'rust-docs'
 15.4 MiB /  15.4 MiB (100 %)   5.2 MiB/s in  3s         
info: downloading component 'rust-std'
 22.7 MiB /  22.7 MiB (100 %)   6.4 MiB/s in  4s         
info: downloading component 'rustc'
 50.9 MiB /  50.9 MiB (100 %)   9.4 MiB/s in  7s         
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 15.4 MiB /  15.4 MiB (100 %)   3.8 MiB/s in  2s         
info: installing component 'rust-std'
 22.7 MiB /  22.7 MiB (100 %)  20.0 MiB/s in  1s         
info: installing component 'rustc'
 50.9 MiB /  50.9 MiB (100 %)  22.9 MiB/s in  2s         
info: installing component 'rustfmt'

  1.79-aarch64-apple-darwin installed - rustc 1.79.0 (129f3b996 2024-06-10)

info: self-update is disabled for this build of rustup
info: any updates to rustup will need to be fetched with your system package manager

> rustup toolchain install 1.79.0
info: syncing channel updates for '1.79.0-aarch64-apple-darwin'
info: latest update on 2024-06-13, rust version 1.79.0 (129f3b996 2024-06-10)
info: downloading component 'cargo'
  6.4 MiB /   6.4 MiB (100 %)   3.0 MiB/s in  3s         
info: downloading component 'clippy'
  2.2 MiB /   2.2 MiB (100 %) 751.4 KiB/s in  2s         
info: downloading component 'rust-docs'
 15.4 MiB /  15.4 MiB (100 %)   1.1 MiB/s in 23s          
info: downloading component 'rust-std'
 22.7 MiB /  22.7 MiB (100 %)   4.1 MiB/s in  7s         
info: downloading component 'rustc'
 50.9 MiB /  50.9 MiB (100 %)   6.4 MiB/s in 10s             
info: downloading component 'rustfmt'
  1.6 MiB /   1.6 MiB (100 %) 737.6 KiB/s in  2s         
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 15.4 MiB /  15.4 MiB (100 %)   4.0 MiB/s in  2s         
info: installing component 'rust-std'
 22.7 MiB /  22.7 MiB (100 %)  21.1 MiB/s in  1s         
info: installing component 'rustc'
 50.9 MiB /  50.9 MiB (100 %)  23.1 MiB/s in  2s         
info: installing component 'rustfmt'

  1.79.0-aarch64-apple-darwin installed - rustc 1.79.0 (129f3b996 2024-06-10)

info: self-update is disabled for this build of rustup
info: any updates to rustup will need to be fetched with your system package manager

This could also be an error specific to toolchain files, but I doubt about it...

@Rigidity can you see your cargo under ~/.rustup/toolchains/*/bin for both versions? If so, that might indicate an internal error within Rustup. Thanks!

@rami3l rami3l added this to the 1.28.0 milestone Jul 17, 2024
@Rigidity
Copy link

This is bizarre, I can't reproduce it no matter what I do now. I see cargo in both and it works with 1.79 in the toolchain now.
I tried reinstalling multiple times before and couldn't get anything to work, so this is pretty strange...
I'll let you know if I run into it again I guess

@rami3l
Copy link
Member

rami3l commented Jul 17, 2024

This is bizarre, I can't reproduce it no matter what I do now. I see cargo in both and it works with 1.79 in the toolchain now. I tried reinstalling multiple times before and couldn't get anything to work, so this is pretty strange... I'll let you know if I run into it again I guess

@Rigidity Thanks for letting me know! 👀 In that case I'll put this into #3937 then...

FWIW our mitigation in #3635, once completed, should address this problem for you for about 70% of the time.

@Rigidity
Copy link

Rigidity commented Jul 17, 2024

I think it might be worth noting that the original issue also coincided with an error saying something like "Could not copy downloaded file to path " when I tried to (re)install 1.79 manually. I'm guessing that it was trying to download Cargo and since it already existed in the destination directory (maybe it was picking the wrong one out of the two?) it failed.

So could have been some sort of corruption or race condition.

@rami3l rami3l modified the milestones: 1.28.0, 1.29.0 Jul 17, 2024
@djc
Copy link
Contributor

djc commented Jul 17, 2024

@rami3l could you give this issue a better title?

@rami3l rami3l changed the title Cargo is not applicable to the 1.64.0 toolchain Cargo is not applicable when using a toolchain specified in rust-toolchain.toml Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants