summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosh Channings <josh.channings@musictribe.com>2022-11-22 21:37:47 +0000
committerJosh Channings <josh.channings@musictribe.com>2022-11-22 21:37:47 +0000
commit2252245f9228f460542166450631d2bc6c534d0f (patch)
tree7b66e43b640a7b9252ca22220ce4a70e42e59632
parent252ea6511df5327518b65043d6813684813c067a (diff)
downloadnixpkgs-2252245f9228f460542166450631d2bc6c534d0f.tar
nixpkgs-2252245f9228f460542166450631d2bc6c534d0f.tar.gz
nixpkgs-2252245f9228f460542166450631d2bc6c534d0f.tar.bz2
nixpkgs-2252245f9228f460542166450631d2bc6c534d0f.tar.lz
nixpkgs-2252245f9228f460542166450631d2bc6c534d0f.tar.xz
nixpkgs-2252245f9228f460542166450631d2bc6c534d0f.tar.zst
nixpkgs-2252245f9228f460542166450631d2bc6c534d0f.zip
llvm: Find otool bin from targetPrefix
This is to fix the stdenvBootstrapTools issue where otool & others are
not available in PATH, but only under the targetPrefix.
-rw-r--r--pkgs/development/compilers/llvm/10/libcxx/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/10/libcxxabi/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/11/libcxx/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/11/libcxxabi/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/12/libcxx/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/12/libcxxabi/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/13/libcxx/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/13/libcxxabi/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/14/libcxx/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/14/libcxxabi/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/5/libcxx/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/5/libcxxabi/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/6/libcxx/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/6/libcxxabi/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/7/libcxx/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/7/libcxxabi/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/8/libcxx/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/8/libcxxabi/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/9/libcxx/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/9/libcxxabi/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/git/libcxx/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/git/libcxxabi/default.nix4
22 files changed, 44 insertions, 44 deletions
diff --git a/pkgs/development/compilers/llvm/10/libcxx/default.nix b/pkgs/development/compilers/llvm/10/libcxx/default.nix
index bf3ddeb58c3..0c0f535f743 100644
--- a/pkgs/development/compilers/llvm/10/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/10/libcxx/default.nix
@@ -55,11 +55,11 @@ stdenv.mkDerivation {
     for file in lib/*.dylib; do
       if [ -L "$file" ]; then continue; fi
 
-      baseName=$(basename $(otool -D $file | tail -n 1))
+      baseName=$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))
       installName="$out/lib/$baseName"
       abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
 
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/10/libcxxabi/default.nix b/pkgs/development/compilers/llvm/10/libcxxabi/default.nix
index 0af20699a1d..d62422fc9a1 100644
--- a/pkgs/development/compilers/llvm/10/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/10/libcxxabi/default.nix
@@ -45,7 +45,7 @@ stdenv.mkDerivation {
       if [ -L "$file" ]; then continue; fi
 
       # Fix up the install name. Preserve the basename, just replace the path.
-      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+      installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))"
 
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
@@ -56,7 +56,7 @@ stdenv.mkDerivation {
       # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
       # libcxxabi to sometimes link against a different version of itself.
       # Here we simply make that second reference point to ourselves.
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/11/libcxx/default.nix b/pkgs/development/compilers/llvm/11/libcxx/default.nix
index 135fed03bee..237bbd4e061 100644
--- a/pkgs/development/compilers/llvm/11/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/11/libcxx/default.nix
@@ -71,11 +71,11 @@ stdenv.mkDerivation {
     for file in lib/*.dylib; do
       if [ -L "$file" ]; then continue; fi
 
-      baseName=$(basename $(otool -D $file | tail -n 1))
+      baseName=$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))
       installName="$out/lib/$baseName"
       abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
 
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/11/libcxxabi/default.nix b/pkgs/development/compilers/llvm/11/libcxxabi/default.nix
index ee410440d50..ed0efe28a17 100644
--- a/pkgs/development/compilers/llvm/11/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/11/libcxxabi/default.nix
@@ -49,7 +49,7 @@ stdenv.mkDerivation {
       if [ -L "$file" ]; then continue; fi
 
       # Fix up the install name. Preserve the basename, just replace the path.
-      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+      installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))"
 
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
@@ -60,7 +60,7 @@ stdenv.mkDerivation {
       # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
       # libcxxabi to sometimes link against a different version of itself.
       # Here we simply make that second reference point to ourselves.
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/12/libcxx/default.nix b/pkgs/development/compilers/llvm/12/libcxx/default.nix
index fdd1690310c..ef90eedb38c 100644
--- a/pkgs/development/compilers/llvm/12/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/12/libcxx/default.nix
@@ -46,11 +46,11 @@ stdenv.mkDerivation {
     for file in lib/*.dylib; do
       if [ -L "$file" ]; then continue; fi
 
-      baseName=$(basename $(otool -D $file | tail -n 1))
+      baseName=$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))
       installName="$out/lib/$baseName"
       abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
 
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/12/libcxxabi/default.nix b/pkgs/development/compilers/llvm/12/libcxxabi/default.nix
index 8d3558a71fe..41c559a52ee 100644
--- a/pkgs/development/compilers/llvm/12/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/12/libcxxabi/default.nix
@@ -47,7 +47,7 @@ stdenv.mkDerivation {
       if [ -L "$file" ]; then continue; fi
 
       # Fix up the install name. Preserve the basename, just replace the path.
-      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+      installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))"
 
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
@@ -58,7 +58,7 @@ stdenv.mkDerivation {
       # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
       # libcxxabi to sometimes link against a different version of itself.
       # Here we simply make that second reference point to ourselves.
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/13/libcxx/default.nix b/pkgs/development/compilers/llvm/13/libcxx/default.nix
index 664e593d3de..f6b76901de3 100644
--- a/pkgs/development/compilers/llvm/13/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/13/libcxx/default.nix
@@ -50,11 +50,11 @@ stdenv.mkDerivation rec {
     for file in lib/*.dylib; do
       if [ -L "$file" ]; then continue; fi
 
-      baseName=$(basename $(otool -D $file | tail -n 1))
+      baseName=$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))
       installName="$out/lib/$baseName"
       abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
 
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/13/libcxxabi/default.nix b/pkgs/development/compilers/llvm/13/libcxxabi/default.nix
index a744bb51480..bced2ccb789 100644
--- a/pkgs/development/compilers/llvm/13/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/13/libcxxabi/default.nix
@@ -44,7 +44,7 @@ stdenv.mkDerivation rec {
       if [ -L "$file" ]; then continue; fi
 
       # Fix up the install name. Preserve the basename, just replace the path.
-      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+      installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))"
 
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
@@ -55,7 +55,7 @@ stdenv.mkDerivation rec {
       # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
       # libcxxabi to sometimes link against a different version of itself.
       # Here we simply make that second reference point to ourselves.
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/14/libcxx/default.nix b/pkgs/development/compilers/llvm/14/libcxx/default.nix
index a637cdbab77..c623d41f92f 100644
--- a/pkgs/development/compilers/llvm/14/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/14/libcxx/default.nix
@@ -66,11 +66,11 @@ stdenv.mkDerivation rec {
     for file in lib/*.dylib; do
       if [ -L "$file" ]; then continue; fi
 
-      baseName=$(basename $(otool -D $file | tail -n 1))
+      baseName=$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))
       installName="$out/lib/$baseName"
       abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
 
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/14/libcxxabi/default.nix b/pkgs/development/compilers/llvm/14/libcxxabi/default.nix
index 731038e8671..3be2f964abc 100644
--- a/pkgs/development/compilers/llvm/14/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/14/libcxxabi/default.nix
@@ -55,7 +55,7 @@ stdenv.mkDerivation rec {
         if [ -L "$file" ]; then continue; fi
 
         # Fix up the install name. Preserve the basename, just replace the path.
-        installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+        installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))"
 
         # this should be done in CMake, but having trouble figuring out
         # the magic combination of necessary CMake variables
@@ -66,7 +66,7 @@ stdenv.mkDerivation rec {
         # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
         # libcxxabi to sometimes link against a different version of itself.
         # Here we simply make that second reference point to ourselves.
-        for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+        for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
           ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
         done
       done
diff --git a/pkgs/development/compilers/llvm/5/libcxx/default.nix b/pkgs/development/compilers/llvm/5/libcxx/default.nix
index f0ed61a153f..a5a86fcab4d 100644
--- a/pkgs/development/compilers/llvm/5/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/5/libcxx/default.nix
@@ -45,11 +45,11 @@ stdenv.mkDerivation {
     for file in lib/*.dylib; do
       if [ -L "$file" ]; then continue; fi
 
-      baseName=$(basename $(otool -D $file | tail -n 1))
+      baseName=$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))
       installName="$out/lib/$baseName"
       abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
 
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/5/libcxxabi/default.nix b/pkgs/development/compilers/llvm/5/libcxxabi/default.nix
index ef47fb62e7b..97077ac7711 100644
--- a/pkgs/development/compilers/llvm/5/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/5/libcxxabi/default.nix
@@ -30,7 +30,7 @@ stdenv.mkDerivation {
       if [ -L "$file" ]; then continue; fi
 
       # Fix up the install name. Preserve the basename, just replace the path.
-      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+      installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))"
 
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
@@ -41,7 +41,7 @@ stdenv.mkDerivation {
       # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
       # libcxxabi to sometimes link against a different version of itself.
       # Here we simply make that second reference point to ourselves.
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/6/libcxx/default.nix b/pkgs/development/compilers/llvm/6/libcxx/default.nix
index 1eb3b121d50..a6e723753ef 100644
--- a/pkgs/development/compilers/llvm/6/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/6/libcxx/default.nix
@@ -51,11 +51,11 @@ stdenv.mkDerivation {
     for file in lib/*.dylib; do
       if [ -L "$file" ]; then continue; fi
 
-      baseName=$(basename $(otool -D $file | tail -n 1))
+      baseName=$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))
       installName="$out/lib/$baseName"
       abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
 
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/6/libcxxabi/default.nix b/pkgs/development/compilers/llvm/6/libcxxabi/default.nix
index 38e47f8c25f..aea126b31d9 100644
--- a/pkgs/development/compilers/llvm/6/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/6/libcxxabi/default.nix
@@ -30,7 +30,7 @@ stdenv.mkDerivation {
       if [ -L "$file" ]; then continue; fi
 
       # Fix up the install name. Preserve the basename, just replace the path.
-      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+      installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))"
 
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
@@ -41,7 +41,7 @@ stdenv.mkDerivation {
       # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
       # libcxxabi to sometimes link against a different version of itself.
       # Here we simply make that second reference point to ourselves.
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/7/libcxx/default.nix b/pkgs/development/compilers/llvm/7/libcxx/default.nix
index b163ceb09f9..145f0df8837 100644
--- a/pkgs/development/compilers/llvm/7/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/7/libcxx/default.nix
@@ -56,11 +56,11 @@ stdenv.mkDerivation {
     for file in lib/*.dylib; do
       if [ -L "$file" ]; then continue; fi
 
-      baseName=$(basename $(otool -D $file | tail -n 1))
+      baseName=$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))
       installName="$out/lib/$baseName"
       abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
 
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/7/libcxxabi/default.nix b/pkgs/development/compilers/llvm/7/libcxxabi/default.nix
index 693ceda0e32..d6f90634cd0 100644
--- a/pkgs/development/compilers/llvm/7/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/7/libcxxabi/default.nix
@@ -49,7 +49,7 @@ stdenv.mkDerivation {
       if [ -L "$file" ]; then continue; fi
 
       # Fix up the install name. Preserve the basename, just replace the path.
-      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+      installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))"
 
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
@@ -60,7 +60,7 @@ stdenv.mkDerivation {
       # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
       # libcxxabi to sometimes link against a different version of itself.
       # Here we simply make that second reference point to ourselves.
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/8/libcxx/default.nix b/pkgs/development/compilers/llvm/8/libcxx/default.nix
index db6059e2ea2..4a078ac9cda 100644
--- a/pkgs/development/compilers/llvm/8/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/8/libcxx/default.nix
@@ -59,11 +59,11 @@ stdenv.mkDerivation {
     for file in lib/*.dylib; do
       if [ -L "$file" ]; then continue; fi
 
-      baseName=$(basename $(otool -D $file | tail -n 1))
+      baseName=$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))
       installName="$out/lib/$baseName"
       abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
 
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/8/libcxxabi/default.nix b/pkgs/development/compilers/llvm/8/libcxxabi/default.nix
index 040b32d0d04..ab2d46f40a4 100644
--- a/pkgs/development/compilers/llvm/8/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/8/libcxxabi/default.nix
@@ -45,7 +45,7 @@ stdenv.mkDerivation {
       if [ -L "$file" ]; then continue; fi
 
       # Fix up the install name. Preserve the basename, just replace the path.
-      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+      installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))"
 
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
@@ -56,7 +56,7 @@ stdenv.mkDerivation {
       # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
       # libcxxabi to sometimes link against a different version of itself.
       # Here we simply make that second reference point to ourselves.
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/9/libcxx/default.nix b/pkgs/development/compilers/llvm/9/libcxx/default.nix
index 6682ec6799b..65441c359d6 100644
--- a/pkgs/development/compilers/llvm/9/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/9/libcxx/default.nix
@@ -55,11 +55,11 @@ stdenv.mkDerivation {
     for file in lib/*.dylib; do
       if [ -L "$file" ]; then continue; fi
 
-      baseName=$(basename $(otool -D $file | tail -n 1))
+      baseName=$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))
       installName="$out/lib/$baseName"
       abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
 
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/9/libcxxabi/default.nix b/pkgs/development/compilers/llvm/9/libcxxabi/default.nix
index adb2f859da7..cfd1c32abd0 100644
--- a/pkgs/development/compilers/llvm/9/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/9/libcxxabi/default.nix
@@ -45,7 +45,7 @@ stdenv.mkDerivation {
       if [ -L "$file" ]; then continue; fi
 
       # Fix up the install name. Preserve the basename, just replace the path.
-      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+      installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))"
 
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
@@ -56,7 +56,7 @@ stdenv.mkDerivation {
       # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
       # libcxxabi to sometimes link against a different version of itself.
       # Here we simply make that second reference point to ourselves.
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/git/libcxx/default.nix b/pkgs/development/compilers/llvm/git/libcxx/default.nix
index f06459258de..95e32041037 100644
--- a/pkgs/development/compilers/llvm/git/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/git/libcxx/default.nix
@@ -80,11 +80,11 @@ stdenv.mkDerivation rec {
     for file in lib/*.dylib; do
       if [ -L "$file" ]; then continue; fi
 
-      baseName=$(basename $(otool -D $file | tail -n 1))
+      baseName=$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))
       installName="$out/lib/$baseName"
       abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
 
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
       done
     done
diff --git a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix
index 24335c697cd..804acd6c745 100644
--- a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix
@@ -73,7 +73,7 @@ stdenv.mkDerivation rec {
       if [ -L "$file" ]; then continue; fi
 
       # Fix up the install name. Preserve the basename, just replace the path.
-      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+      installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))"
 
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
@@ -84,7 +84,7 @@ stdenv.mkDerivation rec {
       # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
       # libcxxabi to sometimes link against a different version of itself.
       # Here we simply make that second reference point to ourselves.
-      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
         ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
       done
     done