diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2021-08-22 19:39:47 +0200 |
---|---|---|
committer | Maximilian Bosch <maximilian@mbosch.me> | 2022-02-27 10:25:33 +0100 |
commit | 7459a4021cb33d71598f0cbf8c798f9168638d3f (patch) | |
tree | 25b7df599db76f068d6a7126cc48896130ba2859 /pkgs/stdenv | |
parent | 97acaf6d65e869abf7dc9e6825aef4c0e7b98432 (diff) |
stdenv-bootstrap: force using new libc from stage2
This fix is needed to work around linker-errors such as undefined reference to `__libc_csu_fini' which I got in almost every derivation which is part of stage2. The reasoning behind this is that the startup-code was simplified[1] and thus `__libc_csu_fini` doesn't exist anymore. A workable solution is to use a newer libc which properly links in stage3. And actually this seems expected given the rationale for stage3: # Construct a third stdenv identical to the 2nd, except that this # one uses the rebuilt Glibc from stage2. It still uses the recent # binutils and rest of the bootstrap tools, including GCC. So this patch basically overrides the libraries inside `gcc-unwrapped` - which is basically the bootstrap tools and thus also contains the libc used in stage3 - with the shared objects from the freshly built libc from stage2. [1] https://sourceware.org/pipermail/libc-alpha/2021-March/123079.html
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r-- | pkgs/stdenv/linux/default.nix | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index d2c28b97ff939..e20ea9e16860a 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -230,7 +230,7 @@ in overrides = self: super: { inherit (prevStage) ccWrapperStdenv - gcc-unwrapped coreutils gnugrep + coreutils gnugrep perl gnum4 bison; dejagnu = super.dejagnu.overrideAttrs (a: { doCheck = false; } ); @@ -254,6 +254,19 @@ in ''; }); + gcc-unwrapped = self.stdenvNoCC.mkDerivation { + inherit (prevStage.gcc-unwrapped) name; + dontUnpack = true; + dontBuild = true; + installPhase = '' + mkdir -p $out + cp -ar ${prevStage.gcc-unwrapped}/* $out/ + chmod -R a+w $out/ + cp -a ${getLibc self}/lib/* $out/lib/ + chmod -R a-w $out/ + ''; + }; + # This also contains the full, dynamically linked, final Glibc. binutils = prevStage.binutils.override { # Rewrap the binutils with the new glibc, so both the next |