You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rustup breaks with cargo-make due to environment variables #3029
error: "/home/runner/.rustup/toolchains/1.61-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/Cargo.lock" does not exist, unable to build with the standard library, try:
rustup component add rust-src --toolchain nightly-2022-04-05-x86_64-unknown-linux-gnu
Which I think is our fault, and I have a fix in #3029 . However it's unclear how the rustup update broke that (maybe the culprit isn't the rustup update)
Apologies for the low-context issue, I figured given that rustup releases are rare it was more valuable for us to report this bug ASAP and work on figuring out more details afterwards. The +nightly thing being broken still seems sus.
error: "/home/runner/.rustup/toolchains/1.61-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/Cargo.lock" does not exist, unable to build with the standard library, try:
rustup component add rust-src --toolchain nightly-2022-04-05-x86_64-unknown-linux-gnu
Okay, looking at this further this is really weird. In our "Load cortex target for no_std build" CI task section in this failing job we call:
Looking closely at the error, I see a couple things wrong:
We're installing rust-src for the toolchain version, which seems sensible and correct. rustup is asking us to install it for the toolchain and target, which seems excessive (and a breaking change?)
It seems like rustup was looking for the file for 1.61-x86_64-unknown-linux-gnu even though that task is running nightly-2022-04-05, and from looking at the error message it clearly wants nightly-2022-04-05, not 1.61. I don't know what's going on here
Both of these things seem to be Rustup bugs. The +nightly-foo failing on Windows seems like another rustup issue but unrelated.
If you are doing cross-builds from within invocations of cargo are you perhaps not being sure to clean your environment of things like RUSTCRUSTDOCRUSTFLAGS or other environment variables which might affect builds? This might be the equivalent of #3031 if so.
If I'm barking up the wrong tree, please tell me and we can investigate further.
That is a problem with Windows locking the file harder. You can add rustup set auto-self-update disable in your CI if you want to prevent this kind of thing.
If you are doing cross-builds from within invocations of cargo are you perhaps not being sure to clean your environment of things like RUSTCRUSTDOCRUSTFLAGS or other environment variables which might affect builds? This might be the equivalent of #3031 if so.
Hmm, we're using cargo-make which might be doing that? But cargo make is used a lot by folks, if that's breaking that's probably a problem.
But I don't think cargo-make sets toolchains that way.
@kinnison@pietroalbini Given that there are no easy ways to "select" a rustup version at this time, would it be a good idea to roll back the release until we know the scope of this problem and can fix it? As far as ICU4X is concerned we can disable some of these tests if we have to, but I'm worried about the wider impact here, it doesn't seem like we're the only ones with this problem, and it's rather hard to debug since I haven't been able to reproduce it locally (I suspect I will be able to on a fresh system)
The problem is that when you call cargo make, cargo sets the RUSTC/etc environment variables based on the current toolchain, and then calls cargo-make .... cargo make then calls cargo +nightly build (i.e., rustup run nightly cargo build) or whatever
this ends up with the following invocation: RUSTC=[..]/stable/[..]/rustc cargo +nightly build. Which greatly confuses cargo and leads to very mixed and confusing error messages, since it's trying to use the nightly toolchain, but stable binaries.
Part of the solution here is probably that cargo-make should be clearing rust-relevant environment variables (cc @sagiegurari) since they get passed in by cargo. Especially when cargo-make is doing its own toolchain selection.
... anything which runs under cargo and expects to invoke cargo on something other than the host toolchain, they should clean up the environment properly before invoking it
Thinking about it more the +nightly-foo issue on windows may also be due to the same kind of bug, if the RUSTC variable ends up with rustc getting called directly instead of te rustup shims
@sffc@Manishearth from what i remember, cargo-make does not set RUSTC env var.
maybe i don't remember correctly.
however, cargo-make does set the CARGO env var before calling commands that require a specific toolchain.
its actually related to sagiegurari/cargo-make#658 which was reported by @sffc 😄
if a change is needed feel free to open an issue and specify whats wrong with the behavior so i'll know what needs fixing.
... anything which runs under cargo and expects to invoke cargo on something other than the host toolchain, they should clean up the environment properly before invoking it
So I don't think "things changing later" is a real problem if the team commits to (and documents) this.
unsetting those 3 env vars is easy and can be worked around now in the makefile env block of any project using the unset capability.
I suspect on cargo-make's side, the answer is that it should unset RUSTC and RUSTDOC, and it should either unset CARGO or set it to a toolchain, if specified.
We need, at some point, to start to resolve this problem in a way which permits us to give the performance boost we were trying to achieve; without breaking your CI
if a cargo subcommand is currently doing from it's own process cargo +<toolchain> <command> is the way to resolve when it's fixed: rustup run <toolchain> cargo <command> instead?
@kinnison btw, mind changing this issue title to something like "new rustup version breaks with error: no such subcommand: +nightly-2022-04-05`" (unfortunately I don't have edit access to this repo anymore)
Activity
Manishearth commentedon Jul 11, 2022
Another error that we're seeing is:
Which I think is our fault, and I have a fix in #3029 . However it's unclear how the rustup update broke that (maybe the culprit isn't the rustup update)
Apologies for the low-context issue, I figured given that rustup releases are rare it was more valuable for us to report this bug ASAP and work on figuring out more details afterwards. The
+nightlything being broken still seems sus.sffc commentedon Jul 11, 2022
Note that the following error only appears on Windows:
Manishearth commentedon Jul 12, 2022
Okay, looking at this further this is really weird. In our "Load cortex target for no_std build" CI task section in this failing job we call:
Looking closely at the error, I see a couple things wrong:
1.61-x86_64-unknown-linux-gnueven though that task is runningnightly-2022-04-05, and from looking at the error message it clearly wants nightly-2022-04-05, not 1.61. I don't know what's going on hereBoth of these things seem to be Rustup bugs. The
+nightly-foofailing on Windows seems like another rustup issue but unrelated.kinnison commentedon Jul 12, 2022
If you are doing cross-builds from within invocations of
cargoare you perhaps not being sure to clean your environment of things likeRUSTCRUSTDOCRUSTFLAGSor other environment variables which might affect builds? This might be the equivalent of #3031 if so.If I'm barking up the wrong tree, please tell me and we can investigate further.
Kryptos-FR commentedon Jul 12, 2022
Maybe a different issue but since the release of the new rustup version, it fails on Windows CI jobs on GitHub.
Minimal repro
Errors in log
Workaround
Looks like it is the self update causing havoc.
Note that it only fails on Windows workers. Linux and macOS didn't have that failure.
kinnison commentedon Jul 12, 2022
That is a problem with Windows locking the file harder. You can add
rustup set auto-self-update disablein your CI if you want to prevent this kind of thing.Emilgardis commentedon Jul 12, 2022
the windows error is very sporadic, see https://github.com/Emilgardis/rustup-windows-issue/runs/7298752016?check_suite_focus=true
to circumvent, do what @kinnison suggest, example with
actions-rs/toolchain(and only doing it on windows since it works well on the unix runners):Manishearth commentedon Jul 12, 2022
Hmm, we're using
cargo-makewhich might be doing that? But cargo make is used a lot by folks, if that's breaking that's probably a problem.But I don't think
cargo-makesets toolchains that way.Manishearth commentedon Jul 12, 2022
unicode-org/icu4x#2170 this confirms it, for whatever reason rustup has decided to use the stable compiler there
Manishearth commentedon Jul 12, 2022
@kinnison @pietroalbini Given that there are no easy ways to "select" a rustup version at this time, would it be a good idea to roll back the release until we know the scope of this problem and can fix it? As far as ICU4X is concerned we can disable some of these tests if we have to, but I'm worried about the wider impact here, it doesn't seem like we're the only ones with this problem, and it's rather hard to debug since I haven't been able to reproduce it locally (I suspect I will be able to on a fresh system)
Manishearth commentedon Jul 12, 2022
What we know so far:
#2958 is a part of this
The problem is that when you call
cargo make,cargosets the RUSTC/etc environment variables based on the current toolchain, and then callscargo-make ....cargo makethen callscargo +nightly build(i.e.,rustup run nightly cargo build) or whateverthis ends up with the following invocation:
RUSTC=[..]/stable/[..]/rustc cargo +nightly build. Which greatly confuses cargo and leads to very mixed and confusing error messages, since it's trying to use the nightly toolchain, but stable binaries.Part of the solution here is probably that
cargo-makeshould be clearing rust-relevant environment variables (cc @sagiegurari) since they get passed in by cargo. Especially whencargo-makeis doing its own toolchain selection.But I'm not sure if that's all of it.
Manishearth commentedon Jul 12, 2022
from @kinnison
Manishearth commentedon Jul 12, 2022
Thinking about it more the
+nightly-fooissue on windows may also be due to the same kind of bug, if the RUSTC variable ends up with rustc getting called directly instead of te rustup shimssagiegurari commentedon Jul 12, 2022
@sffc @Manishearth from what i remember, cargo-make does not set RUSTC env var.
maybe i don't remember correctly.
however, cargo-make does set the CARGO env var before calling commands that require a specific toolchain.
its actually related to sagiegurari/cargo-make#658 which was reported by @sffc 😄
if a change is needed feel free to open an issue and specify whats wrong with the behavior so i'll know what needs fixing.
3 remaining items
Manishearth commentedon Jul 12, 2022
@sagiegurari I don't think that's the problem. This is in part cargo behavior, and how cargo calls custom subcommands.
In general I think the following can be taken as an authoritative statement on what the rustup team's intent is here:
So I don't think "things changing later" is a real problem if the team commits to (and documents) this.
Going to try this!
Manishearth commentedon Jul 12, 2022
I suspect on cargo-make's side, the answer is that it should unset RUSTC and RUSTDOC, and it should either unset CARGO or set it to a toolchain, if specified.
nuzzles commentedon Jul 18, 2022
I think this is relevant #3025
As far as CI goes, trying to update the toolchain on nightly is broken at least (Ubuntu 22.04).
I think this can help narrow the problem:
nuzzles/website@bac36b2
This caused my pipeline to pass.
And locally, I couldn't install the newest nightly until I did a
rustup uninstalland reinstalled nightly, it worked.Somewhere, somehow, someone pushed a bad version, and the only solution is to uninstall and reinstall.
Manishearth commentedon Jul 18, 2022
(note that rustup updates are done via
rustup self update)kinnison commentedon Aug 27, 2022
We need, at some point, to start to resolve this problem in a way which permits us to give the performance boost we were trying to achieve; without breaking your CI
Manishearth commentedon Aug 27, 2022
I mean, we're also happy to make changes on our end, if cargo-make can be updated to handle this and stuff it's also fine.
Such CI tools are popular but I don't think there are actually all too many of them.
Emilgardis commentedon Aug 27, 2022
if a cargo subcommand is currently doing from it's own process
cargo +<toolchain> <command>is the way to resolve when it's fixed:rustup run <toolchain> cargo <command>instead?sagiegurari commentedon Aug 29, 2022
@Manishearth I can unset these 3 env vars by default at the start of cargo-make. that's easy.
that means cargo setting them would be ignored in a way.
Manishearth commentedon Aug 29, 2022
@kinnison btw, mind changing this issue title to something like "new rustup version breaks with
error: no such subcommand:+nightly-2022-04-05`" (unfortunately I don't have edit access to this repo anymore)[-]rustup update broke our CI[/-][+]rustup breaks with cargo-make due to environment variables[/+]sffc commentedon Aug 29, 2022
(title edited)
rami3l commentedon Apr 25, 2024
A gentle ping:
cargo-makehas made sagiegurari/cargo-make#1060 now, does this issue still exist since?wmmc88 commentedon Apr 25, 2024
From the cargo-make side, this issue was worked around and resolved, but im unsure if rustup want to leave this open to address @kinnison comments:
#3029 (comment)
rami3l commentedon Jul 10, 2024
Thanks! Since this change has been reverted in #3034, let's continue the discussion in #3035.