rustup icon indicating copy to clipboard operation
rustup copied to clipboard

rustup component remove component-NOT-TOOLCHAIN-TARGET errors

Open kadiwa4 opened this issue 2 years ago • 4 comments

Problem you are trying to solve

I ran rustup component list --installed and saw that I had the component rust-std-wasm32-unknown-unknown installed, which I wanted to delete. I thought that I could simply copy-paste the component name into the remove command like this:

rustup component remove rust-std-wasm32-unknown-unknown

However, this doesn't work with remove. I got the following unhelpful error message:

error: toolchain 'nightly-x86_64-apple-darwin' does not contain component 'rust-std-wasm32-unknown-unknown' for target 'x86_64-apple-darwin'
note: not all platforms have the standard library pre-compiled: https://doc.rust-lang.org/nightly/rustc/platform-support.html
help: consider using `cargo build -Z build-std` instead

(Also the last line doesn't make sense because I'm trying to uninstall something here, not install it.)

Solution you'd like

The command that actually works is:

rustup component remove --target wasm32-unknown-unknown rust-std

I would like it if rustup told me that. You could assume that the component names which are output by list can also be passed back into rustup as a component name.

Notes

Version 1.25.1

kadiwa4 avatar Jan 16 '23 22:01 kadiwa4

hmm so I totally agree with the motivation here; a path to fixing it would be to parse the target from the output, and infer target when not supplied.

rbtcollins avatar Feb 22 '23 20:02 rbtcollins

Is there a rule to infer the target from the list?

@rustbot claim

SummerGram avatar Mar 01 '23 11:03 SummerGram

@rbtcollins ,

In the component remove function, it is supposed to handle rust-docs-x86_64-apple-darwin this case with function called Component::new_with_target. But in that function, it fails to identify the target from rust-docs-x86_64-apple-darwin and rust-std-wasm32-unknown-unknown.

SummerGram avatar Mar 02 '23 07:03 SummerGram

home/bin/rustup component remove clippy rustfmt-x86_64-apple-darwin rust-docs-x86_64-apple-darwin rust-std-wasm32-unknown-unknown

Component { pkg: "clippy", target: Some(TargetTriple("x86_64-apple-darwin")), is_extension: true }
"rustfmt" "x86_64-apple-darwin"
"rustfmt" "x86_64-apple-darwin" PartialTargetTriple { arch: Some("x86_64"), os: Some("apple-darwin"), env: None }
"rustfmt-x86_64" "apple-darwin"
"rustfmt-x86_64" "apple-darwin" PartialTargetTriple { arch: None, os: Some("apple-darwin"), env: None }
"rustfmt-x86_64-apple" "darwin"
Component { pkg: "rustfmt-x86_64-apple-darwin", target: Some(TargetTriple("x86_64-apple-darwin")), is_extension: true }
"rust" "docs-x86_64-apple-darwin"
"rust-docs" "x86_64-apple-darwin"
"rust-docs" "x86_64-apple-darwin" PartialTargetTriple { arch: Some("x86_64"), os: Some("apple-darwin"), env: None }
"rust-docs-x86_64" "apple-darwin"
"rust-docs-x86_64" "apple-darwin" PartialTargetTriple { arch: None, os: Some("apple-darwin"), env: None }
"rust-docs-x86_64-apple" "darwin"
Component { pkg: "rust-docs-x86_64-apple-darwin", target: Some(TargetTriple("x86_64-apple-darwin")), is_extension: true }
"rust" "std-wasm32-unknown-unknown"
"rust-std" "wasm32-unknown-unknown"
"rust-std-wasm32" "unknown-unknown"
"rust-std-wasm32-unknown" "unknown"
Component { pkg: "rust-std-wasm32-unknown-unknown", target: Some(TargetTriple("x86_64-apple-darwin")), is_extension: true }

SummerGram avatar Mar 02 '23 07:03 SummerGram

Ran into the same thing; was very confused.

cyqsimon avatar Apr 08 '24 06:04 cyqsimon

@kadiwa4 @cyqsimon A new beta release is available, would you mind trying it out?

rami3l avatar Apr 28 '24 00:04 rami3l

@kadiwa4 @cyqsimon A new beta release is available, would you mind trying it out?

All works as expected now as far as I can tell. Thank you for the great work!

cyqsimon avatar Apr 28 '24 05:04 cyqsimon

I saw the fix of this issue was added into milestone 1.27.1. But I still met this bug with rustup 1.27.1.

Execute:

rustup component remove llvm-tools-x86_64-unknown-linux-gnu

Output:

error: toolchain 'stable-x86_64-unknown-linux-gnu' does not contain component 'llvm-tools-x86_64-unknown-linux-gnu' for target 'x86_64-unknown-linux-gnu'

But the following command works well:

rustup component remove --target x86_64-unknown-linux-gnu llvm-tools

chaoticlonghair avatar Aug 13 '24 09:08 chaoticlonghair

I saw the fix of this issue was added into milestone 1.27.1. But I still met this bug with rustup 1.27.1.

Execute:

rustup component remove llvm-tools-x86_64-unknown-linux-gnu

Output:

error: toolchain 'stable-x86_64-unknown-linux-gnu' does not contain component 'llvm-tools-x86_64-unknown-linux-gnu' for target 'x86_64-unknown-linux-gnu'

But the following command works well:

rustup component remove --target x86_64-unknown-linux-gnu llvm-tools

@yangby-cryptape Your case is a bit particular since it's related to a renamed component (https://github.com/rust-lang/rustup/pull/3578). For the moment being, llvm-tools-preview-x86_64-unknown-linux-gnu seems to work.

I'll try to investigate further.

rami3l avatar Aug 14 '24 02:08 rami3l