rust-lang / rustup

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

Unable to add component `rust-src` with `rustup` 1.20.2 #2081

Closed popzxc closed 5 years ago

popzxc commented 5 years ago

Problem I have rustup 1.20.2 installed with complete profile.

When I try to do:

rustup component add rust-src

I get the following error:

error: component 'rust-src' for target 'x86_64-unknown-linux-gnu' is unavailable for download for channel stable

Steps

  1. Install rustup 1.20.2 and use complete profile.
  2. Type rustup component add rust-src

Notes

`rustup` metadata: ```sh ╭─user@pc ~ ╰─$ rustup --version rustup 1.20.2 (13979c968 2019-10-16) ╭─user@pc ~ ╰─$ rustup show Default host: x86_64-unknown-linux-gnu rustup home: /home/user/.rustup installed toolchains -------------------- stable-x86_64-unknown-linux-gnu nightly-x86_64-unknown-linux-gnu active toolchain ---------------- stable-x86_64-unknown-linux-gnu (default) rustc 1.38.0 (625451e37 2019-09-23) ╭─user@pc ~ ╰─$ rustup component list cargo-x86_64-unknown-linux-gnu (installed) clippy-x86_64-unknown-linux-gnu (installed) llvm-tools-preview-x86_64-unknown-linux-gnu (installed) rls-x86_64-unknown-linux-gnu (installed) rust-analysis-x86_64-unknown-linux-gnu (installed) rust-docs-x86_64-unknown-linux-gnu (installed) rust-src rust-std-aarch64-apple-ios rust-std-aarch64-fuchsia rust-std-aarch64-linux-android rust-std-aarch64-pc-windows-msvc rust-std-aarch64-unknown-linux-gnu rust-std-aarch64-unknown-linux-musl rust-std-arm-linux-androideabi rust-std-arm-unknown-linux-gnueabi rust-std-arm-unknown-linux-gnueabihf rust-std-arm-unknown-linux-musleabi rust-std-arm-unknown-linux-musleabihf rust-std-armebv7r-none-eabi rust-std-armebv7r-none-eabihf rust-std-armv5te-unknown-linux-gnueabi rust-std-armv5te-unknown-linux-musleabi rust-std-armv7-apple-ios rust-std-armv7-linux-androideabi rust-std-armv7-unknown-linux-gnueabi rust-std-armv7-unknown-linux-gnueabihf rust-std-armv7-unknown-linux-musleabi rust-std-armv7-unknown-linux-musleabihf rust-std-armv7r-none-eabi rust-std-armv7r-none-eabihf rust-std-armv7s-apple-ios rust-std-asmjs-unknown-emscripten rust-std-i386-apple-ios rust-std-i586-pc-windows-msvc rust-std-i586-unknown-linux-gnu rust-std-i586-unknown-linux-musl rust-std-i686-apple-darwin rust-std-i686-linux-android rust-std-i686-pc-windows-gnu rust-std-i686-pc-windows-msvc rust-std-i686-unknown-freebsd rust-std-i686-unknown-linux-gnu rust-std-i686-unknown-linux-musl rust-std-mips-unknown-linux-gnu rust-std-mips-unknown-linux-musl rust-std-mips64-unknown-linux-gnuabi64 rust-std-mips64el-unknown-linux-gnuabi64 rust-std-mipsel-unknown-linux-gnu rust-std-mipsel-unknown-linux-musl rust-std-nvptx64-nvidia-cuda rust-std-powerpc-unknown-linux-gnu rust-std-powerpc64-unknown-linux-gnu rust-std-powerpc64le-unknown-linux-gnu rust-std-riscv32i-unknown-none-elf rust-std-riscv32imac-unknown-none-elf rust-std-riscv32imc-unknown-none-elf rust-std-riscv64gc-unknown-none-elf rust-std-riscv64imac-unknown-none-elf rust-std-s390x-unknown-linux-gnu rust-std-sparc64-unknown-linux-gnu rust-std-sparcv9-sun-solaris rust-std-thumbv6m-none-eabi rust-std-thumbv7em-none-eabi rust-std-thumbv7em-none-eabihf rust-std-thumbv7m-none-eabi rust-std-thumbv7neon-linux-androideabi rust-std-thumbv7neon-unknown-linux-gnueabihf rust-std-thumbv8m.base-none-eabi rust-std-thumbv8m.main-none-eabi rust-std-thumbv8m.main-none-eabihf rust-std-wasm32-unknown-emscripten rust-std-wasm32-unknown-unknown rust-std-wasm32-wasi rust-std-x86_64-apple-darwin rust-std-x86_64-apple-ios rust-std-x86_64-fortanix-unknown-sgx rust-std-x86_64-fuchsia rust-std-x86_64-linux-android rust-std-x86_64-pc-windows-gnu rust-std-x86_64-pc-windows-msvc rust-std-x86_64-rumprun-netbsd rust-std-x86_64-sun-solaris rust-std-x86_64-unknown-cloudabi rust-std-x86_64-unknown-freebsd rust-std-x86_64-unknown-linux-gnu (installed) rust-std-x86_64-unknown-linux-gnux32 rust-std-x86_64-unknown-linux-musl rust-std-x86_64-unknown-netbsd rustc-x86_64-unknown-linux-gnu (installed) rustfmt-x86_64-unknown-linux-gnu (installed) ```
kinnison commented 5 years ago

I have just installed 1.38.0 freshly for the same target and I can rustup component add rust-src into it.

Could you please find and attach ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/multirust-channel-manifest.toml so that I can take a look and see if that has been damaged?

popzxc commented 5 years ago

Hello, no problem, here it is.

Uploaded (renamed to .txt because github doesn't allow to attach .toml files`)

wdhwg001 commented 5 years ago

multirust-channel-manifest.toml.txt

I got similar error in Windows with rust 1.38.0 and rustup 1.20.2:

error: component 'rust-src' for target 'x86_64-pc-windows-msvc' is unavailable for download for channel stable
wdhwg001 commented 5 years ago

I solved it by following these steps:

  1. Uninstall anything using rustup uninstall stable and rustup self uninstall.
  2. Re-install rust using rustup-init.exe but using default profile instad of complete (and everything else default).

Then it surprisingly works. I guess there might be some issues in the complete profile.

kinnison commented 5 years ago

All those channel manifests look right, so I have no idea how it could have happened for one of you, let alone both of you.

I'd really appreciate it if you could see if you can come up with a reproduction method from fresh install, because if you can, I'll be able to investigate more effectively.

wdhwg001 commented 5 years ago

@kinnison Try these steps:

  1. Fully uninstall rust in Windows, specifically Windows 10 1903 x64.
  2. Download rustup-init.exe form the official website or below. rustup-init.zip
  3. Run it in (your download folder), no need to run as admin.
  4. Customize it to "x86_64-pc-windows-msvc", "stable", "complete" and "yes".
  5. Install and make sure you've installed rustup 1.20.2 and rust 1.38.0.
  6. In a cmd of your download folder, type rustup component add rust-src.
  7. Hopefully you will get the error mentioned. (And the --verbose will show that it reads 12) (7. You may try rustup uninstall stable, and try rustup install stable, it will fail in the installation and said they cannot find some packages.)
    
    C:\Users\0w0\Downloads>rustc --version
    rustc 1.38.0 (625451e37 2019-09-23)

C:\Users\0w0\Downloads>rustup component add rust-src error: component 'rust-src' for target 'x86_64-pc-windows-msvc' is unavailable for download for channel stable

C:\Users\0w0\Downloads>rustup update info: syncing channel updates for 'stable-x86_64-pc-windows-msvc' info: checking for self-updates

stable-x86_64-pc-windows-msvc unchanged - rustc 1.38.0 (625451e37 2019-09-23)

C:\Users\0w0\Downloads>rustup component list cargo-x86_64-pc-windows-msvc (installed) clippy-x86_64-pc-windows-msvc (installed) llvm-tools-preview-x86_64-pc-windows-msvc (installed) rls-x86_64-pc-windows-msvc (installed) rust-analysis-x86_64-pc-windows-msvc (installed) rust-docs-x86_64-pc-windows-msvc (installed) rust-src rust-std-aarch64-apple-ios rust-std-aarch64-fuchsia rust-std-aarch64-linux-android rust-std-aarch64-pc-windows-msvc rust-std-aarch64-unknown-linux-gnu rust-std-aarch64-unknown-linux-musl rust-std-arm-linux-androideabi rust-std-arm-unknown-linux-gnueabi rust-std-arm-unknown-linux-gnueabihf rust-std-arm-unknown-linux-musleabi rust-std-arm-unknown-linux-musleabihf rust-std-armebv7r-none-eabi rust-std-armebv7r-none-eabihf rust-std-armv5te-unknown-linux-gnueabi rust-std-armv5te-unknown-linux-musleabi rust-std-armv7-apple-ios rust-std-armv7-linux-androideabi rust-std-armv7-unknown-linux-gnueabi rust-std-armv7-unknown-linux-gnueabihf rust-std-armv7-unknown-linux-musleabi rust-std-armv7-unknown-linux-musleabihf rust-std-armv7r-none-eabi rust-std-armv7r-none-eabihf rust-std-armv7s-apple-ios rust-std-asmjs-unknown-emscripten rust-std-i386-apple-ios rust-std-i586-pc-windows-msvc rust-std-i586-unknown-linux-gnu rust-std-i586-unknown-linux-musl rust-std-i686-apple-darwin rust-std-i686-linux-android rust-std-i686-pc-windows-gnu rust-std-i686-pc-windows-msvc rust-std-i686-unknown-freebsd rust-std-i686-unknown-linux-gnu rust-std-i686-unknown-linux-musl rust-std-mips-unknown-linux-gnu rust-std-mips-unknown-linux-musl rust-std-mips64-unknown-linux-gnuabi64 rust-std-mips64el-unknown-linux-gnuabi64 rust-std-mipsel-unknown-linux-gnu rust-std-mipsel-unknown-linux-musl rust-std-nvptx64-nvidia-cuda rust-std-powerpc-unknown-linux-gnu rust-std-powerpc64-unknown-linux-gnu rust-std-powerpc64le-unknown-linux-gnu rust-std-riscv32i-unknown-none-elf rust-std-riscv32imac-unknown-none-elf rust-std-riscv32imc-unknown-none-elf rust-std-riscv64gc-unknown-none-elf rust-std-riscv64imac-unknown-none-elf rust-std-s390x-unknown-linux-gnu rust-std-sparc64-unknown-linux-gnu rust-std-sparcv9-sun-solaris rust-std-thumbv6m-none-eabi rust-std-thumbv7em-none-eabi rust-std-thumbv7em-none-eabihf rust-std-thumbv7m-none-eabi rust-std-thumbv7neon-linux-androideabi rust-std-thumbv7neon-unknown-linux-gnueabihf rust-std-thumbv8m.base-none-eabi rust-std-thumbv8m.main-none-eabi rust-std-thumbv8m.main-none-eabihf rust-std-wasm32-unknown-emscripten rust-std-wasm32-unknown-unknown rust-std-wasm32-wasi rust-std-x86_64-apple-darwin rust-std-x86_64-apple-ios rust-std-x86_64-fortanix-unknown-sgx rust-std-x86_64-fuchsia rust-std-x86_64-linux-android rust-std-x86_64-pc-windows-gnu rust-std-x86_64-pc-windows-msvc (installed) rust-std-x86_64-rumprun-netbsd rust-std-x86_64-sun-solaris rust-std-x86_64-unknown-cloudabi rust-std-x86_64-unknown-freebsd rust-std-x86_64-unknown-linux-gnu rust-std-x86_64-unknown-linux-gnux32 rust-std-x86_64-unknown-linux-musl rust-std-x86_64-unknown-netbsd rustc-x86_64-pc-windows-msvc (installed) rustfmt-x86_64-pc-windows-msvc (installed)

C:\Users\0w0\Downloads>where rustup C:\Users\0w0.cargo\bin\rustup.exe

C:\Users\0w0\Downloads>rustup uninstall stable info: uninstalling toolchain 'stable-x86_64-pc-windows-msvc' info: toolchain 'stable-x86_64-pc-windows-msvc' uninstalled

C:\Users\0w0\Downloads>rustup self update info: checking for self-updates

C:\Users\0w0\Downloads>rustup install stable info: syncing channel updates for 'stable-x86_64-pc-windows-msvc' info: latest update on 2019-09-26, rust version 1.38.0 (625451e37 2019-09-23) error: some components unavailable for download for channel stable: 'lldb-preview', 'miri' If you require these components, please install and use the latest successful build version, which you can find at https://rust-lang.github.io/rustup-components-history.

After determining the correct date, install it with a command such as:

rustup toolchain install nightly-2018-12-27

Then you can use the toolchain with commands such as:

cargo +nightly-2018-12-27 build

C:\Users\0w0\Downloads>rustup --verbose install stable verbose: read metadata version: '12' verbose: installing toolchain 'stable-x86_64-pc-windows-msvc' verbose: toolchain directory: 'C:\Users\0w0.rustup\toolchains\stable-x86_64-pc-windows-msvc' info: syncing channel updates for 'stable-x86_64-pc-windows-msvc' verbose: creating temp file: C:\Users\0w0.rustup\tmp\6wjtkknb701gamfe_file verbose: downloading file from: 'https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256' verbose: downloading with reqwest verbose: deleted temp file: C:\Users\0w0.rustup\tmp\6wjtkknb701gamfe_file verbose: no update hash at: 'C:\Users\0w0.rustup\update-hashes\stable-x86_64-pc-windows-msvc' verbose: creating temp file: C:\Users\0w0.rustup\tmp\pdw93618vak27kie_file.toml verbose: downloading file from: 'https://static.rust-lang.org/dist/channel-rust-stable.toml' verbose: downloading with reqwest verbose: checksum passed verbose: deleted temp file: C:\Users\0w0.rustup\tmp\pdw93618vak27kie_file.toml info: latest update on 2019-09-26, rust version 1.38.0 (625451e37 2019-09-23) verbose: removing toolchain directory: 'C:\Users\0w0.rustup\toolchains\stable-x86_64-pc-windows-msvc' error: some components unavailable for download for channel stable: 'lldb-preview', 'miri' If you require these components, please install and use the latest successful build version, which you can find at https://rust-lang.github.io/rustup-components-history.

After determining the correct date, install it with a command such as:

rustup toolchain install nightly-2018-12-27

Then you can use the toolchain with commands such as:

cargo +nightly-2018-12-27 build
popzxc commented 5 years ago

My actions were completely the same, but for linux.

kinnison commented 5 years ago

Wonderful, thank you for that reproduction process. I shall try it out and see if I can work out what's going on.

kinnison commented 5 years ago

Okay this is something odd about how we install rust-src when it's specified by the profile rather than on the CLI.

My analysis thus-far is:

  1. It is actually installing rust-src
  2. rustup component list | grep rust-src does not show it as installed, though it is there
  3. When installed, rustup component add rust-src will fail with that bad error message
  4. rustup component remove rust-src will uninstall it
  5. At which point rustup component add rust-src will install it
  6. At which point rustup component list | grep rust-src shows it installed
  7. And then rustup component add rust-src says it's already up-to-date.

So I'm going to look into how rustup component add rust-src differs in terms of how the component is installed relative to how it comes from the profile directly.

TomaszWaszczyk commented 3 years ago

In 2021 I have very similar error which sounds like:

rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.toml file /home/tomek/workspaces/Bit-Country-Blockchain/Cargo.toml, cargo 1.55.0-nightly (3ebb5f15a 2021-07-02): Failed to run `cargo metadata --manifest-path /home/tomek/workspaces/Bit-Country-Blockchain/Cargo.toml` in `/home/tomek/workspaces/Bit-Country-Blockchain`: `cargo metadata` exited with an error:  Downloading crates ...
error: failed to download `parity-db v0.2.3`

Caused by:
  unable to get packages from source

Caused by:
  failed to parse manifest at `/home/tomek/.cargo/registry/src/github.com-1ecc6299db9ec823/parity-db-0.2.3/Cargo.toml`

Caused by:
  failed to parse the version requirement `0.11 ` for dependency `parking_lot`

Caused by:
  expected comma after minor version number, found '\t'

Any idea how to cope with that?

kinnison commented 3 years ago

@TomaszWaszczyk That looks entirely unrelated - there's a typo in that package's Cargo.toml (a tab is present in a version string) maybe you accidentally edited that file?

TomaszWaszczyk commented 3 years ago

Thanks, no idea why but there was an error in fetched dependency, no idea why, solved!