Skip to content

Commit

Permalink
glibc: copy libgcc_s.so from .lib output if it exists
Browse files Browse the repository at this point in the history
Otherwise copy it from the default output. The difference is visible
when we build `glibc` with:

- `bootstrapTools` `gcc`: ${stdenv.cc.cc.out}/lib/libgcc_s.so.1 is used
- `nixpkgs` `gcc`: ${stdenv.cc.cc.lib}/lib/libgcc_s.so.1 is used

Noticed when experimented with multiple `gcc` rebuilds in bootstrap.

While at it killing `RUNPATH` reference to bootstrap `glibc`. We expect
`libgcc_s.so.1` to be used with currently installed `glibc` anyway.
  • Loading branch information
trofi committed Jan 14, 2023
1 parent 66bc6e3 commit 1d93e69
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkgs/development/libraries/glibc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,14 @@ callPackage ./common.nix { inherit stdenv; } {
# - clang-wrapper in cross-compilation
# Last attempt: https://github.com/NixOS/nixpkgs/pull/36948
preInstall = ''
if [ -f ${stdenv.cc.cc}/lib/libgcc_s.so.1 ]; then
if [ -f ${lib.getLib stdenv.cc.cc}/lib/libgcc_s.so.1 ]; then
mkdir -p $out/lib
cp ${stdenv.cc.cc}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so.1
cp ${lib.getLib stdenv.cc.cc}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so.1
# the .so It used to be a symlink, but now it is a script
cp -a ${stdenv.cc.cc}/lib/libgcc_s.so $out/lib/libgcc_s.so
cp -a ${lib.getLib stdenv.cc.cc}/lib/libgcc_s.so $out/lib/libgcc_s.so
# wipe out reference to previous libc it was built against
chmod +w $out/lib/libgcc_s.so.1
patchelf --set-rpath $out/lib $out/lib/libgcc_s.so.1
fi
'';

Expand Down

0 comments on commit 1d93e69

Please sign in to comment.