glibc: symlink libpthread.so -> libpthread.so.0 (same for -lrt) for backwards compatibility

Linking via `-lpthread` (or `-pthread`) is not needed anymore since
`glibc-2.34` since all the functionality is part of `libc.so.6` and
`libpthread.so.6` only exists for backwards-compatibility.

However, e.g. `gcc` (`libgomp` to be precise) expects a `libpthread.so`
to link against, otherwise the configure script will fail. As already
stated in the glibc release-notes itself, it is to expect that a lot
more applications will have issues with this, so I decided to re-add
`libpthread.so` as well.

For `librt.so.1`, the same thing is needed to make sure that Perl still
compiles:

    /nix/store/d6y5r7m93x14bmgn2p75fannz39jz66f-binutils-2.35.1/bin/ld: cannot find -lrt
    collect2: error: ld returned 1 exit status
    make[1]: *** [Makefile:490: ../../lib/auto/Time/HiRes/HiRes.so] Error 1
    make[1]: Leaving directory '/build/perl-5.34.0/dist/Time-HiRes'
This commit is contained in:
Maximilian Bosch 2021-08-22 19:40:56 +02:00
parent 7459a4021c
commit 7bc32b3e5c
No known key found for this signature in database
GPG key ID: 091DBF4D1FC46B8E

View file

@ -119,6 +119,14 @@ callPackage ./common.nix { inherit stdenv; } {
# Get rid of more unnecessary stuff.
rm -rf $out/var $bin/bin/sln
# Backwards-compatibility to fix e.g.
# "configure: error: Pthreads are required to build libgomp" during `gcc`-build
# because it's not actually needed anymore to link against `pthreads` since
# it's now part of `libc.so.6` itself, but the gcc build breaks if
# this doesn't work.
ln -sf $out/lib/libpthread.so.0 $out/lib/libpthread.so
ln -sf $out/lib/librt.so.1 $out/lib/librt.so
''
# For some reason these aren't stripped otherwise and retain reference
# to bootstrap-tools; on cross-arm this stripping would break objects.