binutils-unwrapped-all-targets: fix libctf breakage

Before the change 'postFixup' was breaking binaries as it deleted `libctf.so`'s
dependency without fixing the links (https://hydra.nixos.org/build/173957444):

  objdump:
    symbol lookup error: ...-binutils-2.38/lib/libctf.so.0: undefined symbol: htab_eq_string

Instead of tying binutils and libbfd together let's stop replacing the
libraries and use local copies. They are not mechanically interchangeable.

Ideally binutils' upstream build system should allow linking external
`libbfd`/`libopcodes`/`libctf` but we are not there yet.
This commit is contained in:
Sergei Trofimovich 2022-04-23 08:13:09 +01:00
parent f684f5a955
commit 27f20550b4

View file

@ -21,7 +21,7 @@ in
, enableGold ? execFormatIsELF stdenv.targetPlatform
, enableShared ? !stdenv.hostPlatform.isStatic
# WARN: Enabling all targets increases output size to a multiple.
, withAllTargets ? false, libbfd, libopcodes
, withAllTargets ? false
}:
# WARN: configure silently disables ld.gold if it's unsupported, so we need to
@ -183,11 +183,9 @@ stdenv.mkDerivation {
# Fails
doCheck = false;
postFixup = lib.optionalString (enableShared && withAllTargets) ''
rm "$out"/lib/lib{bfd,opcodes}-${version}.so
ln -s '${lib.getLib libbfd}/lib/libbfd-${version}.so' "$out/lib/"
ln -s '${lib.getLib libopcodes}/lib/libopcodes-${version}.so' "$out/lib/"
'';
# Remove on next bump. It's a vestige of past conditional. Stays here to avoid
# mass rebuild.
postFixup = "";
# INFO: Otherwise it fails with:
# `./sanity.sh: line 36: $out/bin/size: not found`