about summary refs log tree commit diff
path: root/pkgs/development/compilers/llvm/14/libcxxabi
diff options
context:
space:
mode:
authorStéphan Kochen <git@stephank.nl>2022-08-09 12:17:47 +0200
committerStéphan Kochen <git@stephank.nl>2022-08-26 17:02:11 +0200
commit96e4a0f05c413f98664349ef94d1391d0b4a0176 (patch)
treef33bf58b242c7bc1e74f76e00065da73abffe75d /pkgs/development/compilers/llvm/14/libcxxabi
parent882732454c87679eb63426e0781fb70b0a3ff35c (diff)
libcxxabi: remove link with build libcxxabi
Diffstat (limited to 'pkgs/development/compilers/llvm/14/libcxxabi')
-rw-r--r--pkgs/development/compilers/llvm/14/libcxxabi/default.nix13
1 files changed, 12 insertions, 1 deletions
diff --git a/pkgs/development/compilers/llvm/14/libcxxabi/default.nix b/pkgs/development/compilers/llvm/14/libcxxabi/default.nix
index d64708ab040ae..0487f1d0de83c 100644
--- a/pkgs/development/compilers/llvm/14/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/14/libcxxabi/default.nix
@@ -52,12 +52,23 @@ stdenv.mkDerivation rec {
   installPhase = if stdenv.isDarwin
     then ''
       for file in lib/*.dylib; do
+        # Fix up the install name. Preserve the basename, just replace the path.
+        installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+
         # this should be done in CMake, but having trouble figuring out
         # the magic combination of necessary CMake variables
         # if you fancy a try, take a look at
         # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
-        install_name_tool -id $out/$file $file
+        ${stdenv.cc.targetPrefix}install_name_tool -id $installName $file
+
+        # 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
+          ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
+        done
       done
+
       make install
       install -d 755 $out/include
       install -m 644 ../include/*.h $out/include