-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bootstrap atop nix atop non-nix (old, Linux) OS fails with inscrutable errors #115073
Labels
C-bug
Category: This is a bug.
T-bootstrap
Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Comments
rustbot
added
the
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
label
Aug 21, 2023
pnkfelix
added
the
T-bootstrap
Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
label
Aug 21, 2023
Oh there is already a toml flag here: rust/src/bootstrap/bootstrap.py Lines 646 to 649 in fe5f591
|
compiler-errors
removed
the
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
label
Aug 21, 2023
My new-ish plan is:
|
eopb
added a commit
to eopb/rustc-dev-guide
that referenced
this issue
Aug 22, 2023
Bootstraps nix detection isn't always perfect: - https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Bootstrapping.20on.20NixOS - rust-lang/rust#115073
cc PR #89426, which is where we first added the flag that allows patching the binaries outside of NixOS |
pnkfelix
pushed a commit
to rust-lang/rustc-dev-guide
that referenced
this issue
Aug 22, 2023
Bootstraps nix detection isn't always perfect: - https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Bootstrapping.20on.20NixOS - rust-lang/rust#115073
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: This is a bug.
T-bootstrap
Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
After being introduced to Nix by a colleague, I have been trying to use the Nix package manager as a basis for rustc development.
However, if I install Nix atop an old Linux OS distribution (or, more precisely, atop a Linux OS that has a relatively old glibc version), I hit problems during the bootstrap step for building rustc locally.
For example, if I follow these steps:
nix develop nixpkgs#rustc
, to establish a subshell that has a nix-based context with the dependencies necessary to buildrustc
(things like the C compiler, cmake, python3, etc)curl -O https://static.rust-lang.org/dist/rustc-1.71.1-src.tar.gz
to download the source distribution from the projecttar xzf rustc-1.71.1-src.tar.gz
cd rustc-1.71.1-src/
echo 'profile = "compiler"' > config.toml
./x.py build --stage 1
then, for me, that latter command terminates with:
There's a couple of different issues here.
I now think I understand, in broad strokes, why this is happening.
It is happening because on Nix, we need to patch the binary's dynamic linker (
.interp
) and dynamic library search path (rpath/RUNPATH) so that they point at the Nix-specific values ...rust/src/bootstrap/bootstrap.py
Lines 669 to 674 in fe5f591
... and the logic in
bootstrap.py
that drives this choice is a heuristic that assumes if you're using Nix, it must be NixOS.rust/src/bootstrap/bootstrap.py
Lines 624 to 650 in fe5f591
The problem is that some contributors are going to use Nix outside of NixOS, e.g. in the manner described by the steps above, and they need some kind of accommodation here.
(To be clear: Most people using Nix, inside or outside of NixOS, are not going to be using our distributed tar balls nor running the
x.py
in those tarballs at all. Most people using Nix are going to use Nix's own package management system, which has already incorporated their own logic for patching the binaries in the necessary manner here.)So, action items:
At bare minimum, the bootstrap config.toml should be slightly generalized, to provide a user-accessible key that will control that(this exists, though it perhaps should be generalized slightly... see comment below)fix_bin_or_dylib
patching behavior, where one can explicitly opt-in, opt-out, or fall back on whatever heuristic is currently in place to infer the right value here.rustc --version --verbose
output to try to provide some hints that might tell us that is the underlying problem here.The text was updated successfully, but these errors were encountered: