diff --git a/pkgs/build-support/setup-hooks/auto-patchelf.py b/pkgs/build-support/setup-hooks/auto-patchelf.py index efb65a809962d..e731feb1b1256 100644 --- a/pkgs/build-support/setup-hooks/auto-patchelf.py +++ b/pkgs/build-support/setup-hooks/auto-patchelf.py @@ -131,7 +131,14 @@ def populate_cache(initial: List[Path], recursive: bool =False) -> None: if not path.is_file(): continue + # As an optimisation, resolve the symlinks here, as the target is unique + # XXX: (layus, 2022-07-25) is this really an optimisation in all cases ? + # It could make the rpath bigger or break the fragile precedence of $out. resolved = path.resolve() + # Do not use resolved paths when names do not match + if resolved.name != path.name: + resolved = path + try: with open_elf(path) as elf: osabi = get_osabi(elf) diff --git a/pkgs/tools/backup/tsm-client/default.nix b/pkgs/tools/backup/tsm-client/default.nix index ef94eee2429fa..03bd62924048d 100644 --- a/pkgs/tools/backup/tsm-client/default.nix +++ b/pkgs/tools/backup/tsm-client/default.nix @@ -159,16 +159,6 @@ let ln --symbolic --force --no-target-directory "$out/$(cut -b 7- <<< "$target")" "$link" done ''; - - # since 7b9fd5d1c9802131ca0a01ff08a3ff64379d2df4 - # autopatchelf misses to add $out/lib to rpath; - # we have to call autopatchelf manually as it would - # run too late and overwrite our rpath otherwise - dontAutoPatchelf = true; - postFixup = '' - autoPatchelf $out - patchelf --add-rpath $out/lib $out/lib/* - ''; }; binPath = lib.makeBinPath ([ acl gnugrep procps ]