rust-lang / rustup

The Rust toolchain installer
https://rust-lang.github.io/rustup/
Apache License 2.0
6.16k stars 888 forks source link

error: 'cargo' is not installed for the toolchain 'stable-x86_64-unknown-linux-gnu' #2701

Open RickHunterS opened 3 years ago

RickHunterS commented 3 years ago

Problem When I use "curl - SSF" https://sh.rustup.rs |After sh "installation, the corresponding cargo module has been installed, but it will report an error when I query the cargo version information or other software needs to call it

Steps

1.curl - SSF" https://sh.rustup.rs |After sh 2.Adopt default installation scheme 3.cargo --version

The specific error reporting information is as follows: [root@racknerd-acba13 ~]# cargo --version info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2021-03-25, rust version 1.51.0 (2fd73fabe 2021-03-23) info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2021-03-25, rust version 1.51.0 (2fd73fabe 2021-03-23) info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2021-03-25, rust version 1.51.0 (2fd73fabe 2021-03-23) info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2021-03-25, rust version 1.51.0 (2fd73fabe 2021-03-23) info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2021-03-25, rust version 1.51.0 (2fd73fabe 2021-03-23) info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2021-03-25, rust version 1.51.0 (2fd73fabe 2021-03-23) error: 'cargo' is not installed for the toolchain 'stable-x86_64-unknown-linux-gnu' To install, run rustup component add cargo [root@racknerd-acba13 ~]# rustup component add cargo info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2021-03-25, rust version 1.51.0 (2fd73fabe 2021-03-23) error: toolchain 'stable-x86_64-unknown-linux-gnu' does not support components [root@racknerd-acba13 ~]# cd /root/.cargo/bin [root@racknerd-acba13 bin]# ./cargo --version info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2021-03-25, rust version 1.51.0 (2fd73fabe 2021-03-23) info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2021-03-25, rust version 1.51.0 (2fd73fabe 2021-03-23) info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2021-03-25, rust version 1.51.0 (2fd73fabe 2021-03-23) info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2021-03-25, rust version 1.51.0 (2fd73fabe 2021-03-23) info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2021-03-25, rust version 1.51.0 (2fd73fabe 2021-03-23) info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2021-03-25, rust version 1.51.0 (2fd73fabe 2021-03-23) error: 'cargo' is not installed for the toolchain 'stable-x86_64-unknown-linux-gnu' To install, run rustup component add cargo

Notes

Output of rustup --version: [root@racknerd-acba13 ~]# rustup --version rustup 1.23.1 (3df2264a9 2020-11-30) info: This is the version for the rustup toolchain manager, not the rustc compiler. info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2021-03-25, rust version 1.51.0 (2fd73fabe 2021-03-23) info: The currently active rustc version is (rustc does not exist) Output of rustup show: [root@racknerd-acba13 ~]# rustup show Default host: x86_64-unknown-linux-gnu rustup home: /root/.rustup

info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2021-03-25, rust version 1.51.0 (2fd73fabe 2021-03-23) stable-x86_64-unknown-linux-gnu (default) (rustc does not exist)

The system environment is CentOS 7.9.2009 (py3.7.9)

If you need any feedback, please leave me a message. Thank you very much for your help and look forward to your reply Here is a partial screenshot: QQ截图20210326105532 QQ截图20210326103545 QQ截图20210326103308

kinnison commented 3 years ago

This looks like CentOS may be missing a library which the new rust release needs. To test that, please run:

$ ldd `rustup which cargo`

And provide the output of that in a comment. My guess is that one or more of the libraries which cargo depends on are not available on your system. If we can identify which, we can work on fixing it.

makslevental commented 3 years ago

i'm in this incredibly frustrating loop as well on ubuntu 18

azureuser@datastation:~$ ldd rustup which cargo info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2021-03-25, rust version 1.51.0 (2fd73fabe 2021-03-23) error: not a file: '/home/azureuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo' ldd: missing file arguments Try `ldd --help' for more information.

kinnison commented 3 years ago

@makslevental Hmm, that error message is worrisome -- What happens if you do:

ls -ld '/home/azureuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo' ?

makslevental commented 3 years ago

@kinnison note that I had to install the toolchain using apt-get to work around this. So I uninstalled it (which is fine because I only needed to compile a dep of a python package) and trying to repro again I do not get this error. That is to say that cargo installed successfully when executing curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh. If I have some time soon I will try to repro on a fresh azure instance.

rbtcollins commented 3 years ago

@makslevental any reproduction of the issue since then ?