Closed golddranks closed 3 months 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?
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.
Okay, then the message should say "host triplet not found", no?
Yes I think 'host' would be clearer in this case.
This could possibly even determine that the triple is a valid target and make a suggestion to run target add
.
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.
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.
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'
Rustup now will search for the last valid toolchain, is still still valid?
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.
If I try to set
nightly-x86_64-unknown-linux-musl
as the default toolchain, I get an error:But obviously the target exists because I can compile with
cargo build --target=x86_64-unknown-linux-musl
just fine.