From 38207735f425a06563482c726b25a0967bc9011d Mon Sep 17 00:00:00 2001 From: Andrew Childs Date: Mon, 24 May 2021 14:15:09 +0900 Subject: [PATCH] darwin/make-bootstrap-tools: move "lib" from install name to rpath The rpath structure for the bootstrap tools was reworked to minimize the amount of rewriting required on unpack, but the test was not updated to match the different structure. Additionally [1] builds that use the bootstrap version of libc++ cannot find libc++abi if the reference includes the "lib" component (ie, libc++ refers to libc++abi with @rpath/lib/libc++abi.dylib). [1] https://logs.nix.samueldr.com/nix-darwin/2021-05-18#4993282 Test failure observed on Hydra: https://hydra.nixos.org/build/143130126 --- pkgs/stdenv/darwin/make-bootstrap-tools.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkgs/stdenv/darwin/make-bootstrap-tools.nix b/pkgs/stdenv/darwin/make-bootstrap-tools.nix index a42499eebce7..3af444a2e52c 100644 --- a/pkgs/stdenv/darwin/make-bootstrap-tools.nix +++ b/pkgs/stdenv/darwin/make-bootstrap-tools.nix @@ -136,9 +136,7 @@ in rec { local libs=$(${stdenv.cc.targetPrefix}otool -L "$1" | tail -n +2 | grep -o "$NIX_STORE.*-\S*") || true local newlib for lib in $libs; do - newlib=''${lib:${toString (storePrefixLen + 1)}} - newlib=''${newlib#*/} - ${stdenv.cc.targetPrefix}install_name_tool -change $lib "@rpath/$newlib" "$1" + ${stdenv.cc.targetPrefix}install_name_tool -change $lib "@rpath/$(basename "$lib")" "$1" done } @@ -160,7 +158,7 @@ in rec { for i in $out/bin/*; do if test -x "$i" -a ! -L "$i" -a "$(basename $i)" != codesign; then echo "Adding @executable_path to rpath in $i" - ${stdenv.cc.targetPrefix}install_name_tool -add_rpath '@executable_path/..' $i + ${stdenv.cc.targetPrefix}install_name_tool -add_rpath '@executable_path/../lib' $i fi done