diff options
Diffstat (limited to 'pkgs/development/compilers/llvm/5/libcxxabi/default.nix')
-rw-r--r-- | pkgs/development/compilers/llvm/5/libcxxabi/default.nix | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/pkgs/development/compilers/llvm/5/libcxxabi/default.nix b/pkgs/development/compilers/llvm/5/libcxxabi/default.nix index 60a41ab2d83..f2f707ec445 100644 --- a/pkgs/development/compilers/llvm/5/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/5/libcxxabi/default.nix @@ -27,11 +27,21 @@ stdenv.mkDerivation { preInstall = lib.optionalString stdenv.isDarwin '' 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 ''; |