rust-lang / rustup

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

"Target not found", even though it exists #834

Closed golddranks closed 3 months ago

golddranks commented 7 years ago

If I try to set nightly-x86_64-unknown-linux-musl as the default toolchain, I get an error:

$ rustup default nightly-x86_64-unknown-linux-musl
info: syncing channel updates for 'nightly-x86_64-unknown-linux-musl'
error: target not found: 'x86_64-unknown-linux-musl'

But obviously the target exists because I can compile with cargo build --target=x86_64-unknown-linux-musl just fine.

golddranks commented 7 years ago

Okay, maybe it's just that the error message is unclear? I think rustup default sets the host toolchain, and musl is available only as a cross-compile target? Is that right?

xen0n commented 7 years ago

Yeah the default and toolchain subcommands all deal with host toolchains -- the executables and libraries that make up the compiler. You manage targets through the target subcommand.

golddranks commented 7 years ago

Okay, then the message should say "host triplet not found", no?

brson commented 7 years ago

Yes I think 'host' would be clearer in this case.

brson commented 7 years ago

This could possibly even determine that the triple is a valid target and make a suggestion to run target add.

xen0n commented 7 years ago

Hmm, #826 seems relevant too. Might as well fix both at once. We should check on update (update, install, toolchain add and the like are all crazy aliases for the underlying update operation) if the target triple passed in is different from the host one, and prompt the user with target sub-commands in that case.

mcandre commented 6 years ago

Same error in Void Linux 3.7. I can install rustup via xbpx-install, but then when I actually try to install a toolchain, rustup complains that the musl target is missing.

tooreht commented 6 years ago

Same error in Void Linux 4.15. I can install rustup via xbpx-install, but then when I actually try to install a toolchain, rustup complains that the musl target is missing:

$ rustup override add nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-musl'
260.7 KiB / 260.7 KiB (100 %)  19.4 KiB/s ETA:   0 s                
info: latest update on 2018-03-31, rust version 1.26.0-nightly (80785a547 2018-03-30)
error: target not found: 'x86_64-unknown-linux-musl'
pickfire commented 4 years ago

Rustup now will search for the last valid toolchain, is still still valid?

rami3l commented 3 months ago

I'm closing this issue as resolved now. Please feel free to reopen if this is still needed.

FWIW I tried the following and it seems to work:

> docker run -it rust:alpine
/ # rustup
rustup 1.27.0 (bbb9276d2 2024-03-08)
<SNIP>
/ # rustup default nightly-x86_64-unknown-linux-musl
info: syncing channel updates for 'nightly-x86_64-unknown-linux-musl'
info: latest update on 2024-06-09, rust version 1.81.0-nightly (f21554f7f 2024-06-08)
info: downloading component 'cargo'
info: downloading component 'rust-std'
 33.1 MiB /  33.1 MiB (100 %)   9.3 MiB/s in  3s ETA:  0s
info: downloading component 'rustc'
 79.8 MiB /  79.8 MiB (100 %)   8.8 MiB/s in  9s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-std'
 33.1 MiB /  33.1 MiB (100 %)  19.9 MiB/s in  1s ETA:  0s
info: installing component 'rustc'
 79.8 MiB /  79.8 MiB (100 %)  22.8 MiB/s in  3s ETA:  0s
info: default toolchain set to 'nightly-x86_64-unknown-linux-musl'

  nightly-x86_64-unknown-linux-musl installed - (error reading rustc version)

... where the last line is expected because I'm on ARM64 and not x64, but anyway.