Open jonas-schievink opened 3 years ago
Perhaps we should solve the haunting?
Perhaps we should solve the haunting?
This is NixOS - it has virtual environments with different versions of libc installed.
@jonas-schievink it's surprising to me that affects the toolchain itself - are you sure cargo clean
and then running cargo build
in nix-shell doesn't work?
Thanks for opening this issue, I was just about to report it myself.
@jyn514 I'm on NixOS as well and experienced this exact error. A cargo clean
did not suffice. I had to rustup uninstall
and rustup install
, then it worked.
The issue is that rustup on nix os runs patchelf on the downloaded executables, there is a custom patch. However, when you update your OS and run nix garbage collection, it removes the libraries that the patched executables point to. One could think about rustup recording the installed toolchains as gc roots and thus preventing the used libraries from being garbage collected, but this makes old libraries stay around if you want to keep older pinned toolchains around for bisection purposes. A command to force-reinstall all installed toolchains and re-run patchelf would be the best, because then one can safely discard of the old libraries.
Can you just rerun patchelf?
On Sun, 29 Aug 2021 at 02:14, est31 @.***> wrote:
The issue is that rustup on nix os runs patchelf on the downloaded executables, there is a custom. However, when you update your OS and run nix garbage collection, it removes the libraries that the patched executables point to. One could think about rustup recording the installed toolchains as gc roots and thus preventing them from being garbage collected, but this makes old libraries stay around if you want to keep older pinned toolchains around for bisection purposes. A command to force-reinstall all installed toolchains and re-run patchelf would be the best, because then one can safely discard of the old libraries.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rust-lang/rustup/issues/2820#issuecomment-907706731, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADZ7XWDXG5DLJ2YMVK45SDT7F3X5ANCNFSM474V53FQ .
@rbtcollins that would be an interesting question to find out. A force-reinstall feature is I think always helpful if e.g. the install became corrupted for some reason. I know that some projects using the android NDK like to mess up the NDK for example. Many package managers like apt have reinstall features.
I think supporting a rustup update --reinstall
type approach wouldn't be entirely mad. We could analyse the toolchain to try and acquire information about installed components, and then internally do an uninstall/install with appropriate arguments. It wouldn't be easy but it should be too complex to plumb in.
Describe the problem you are trying to solve
My computer is haunted, and if I don't set the right environment variables before
rustup update
, the toolchain it installs will fail to use any procedural macros with fun errors likeDescribe the solution you'd like
Because I re-learn this fun fact after every Rust release, I end up with broken toolchains a lot. It would be helpful if rustup supported a way to force a reinstallation of a toolchain and all of its components and targets, without having to use
rustup uninstall
, since that would mean I have to reinstall every component and target I use.