diff options
author | Stéphan Kochen <git@stephank.nl> | 2022-08-09 12:17:47 +0200 |
---|---|---|
committer | Stéphan Kochen <git@stephank.nl> | 2022-08-26 17:02:11 +0200 |
commit | 96e4a0f05c413f98664349ef94d1391d0b4a0176 (patch) | |
tree | f33bf58b242c7bc1e74f76e00065da73abffe75d | |
parent | 882732454c87679eb63426e0781fb70b0a3ff35c (diff) | |
download | nixpkgs-96e4a0f05c413f98664349ef94d1391d0b4a0176.tar nixpkgs-96e4a0f05c413f98664349ef94d1391d0b4a0176.tar.gz nixpkgs-96e4a0f05c413f98664349ef94d1391d0b4a0176.tar.bz2 nixpkgs-96e4a0f05c413f98664349ef94d1391d0b4a0176.tar.lz nixpkgs-96e4a0f05c413f98664349ef94d1391d0b4a0176.tar.xz nixpkgs-96e4a0f05c413f98664349ef94d1391d0b4a0176.tar.zst nixpkgs-96e4a0f05c413f98664349ef94d1391d0b4a0176.zip |
libcxxabi: remove link with build libcxxabi
11 files changed, 122 insertions, 11 deletions
diff --git a/pkgs/development/compilers/llvm/10/libcxxabi/default.nix b/pkgs/development/compilers/llvm/10/libcxxabi/default.nix index 482ced8e0c3..c61f4848558 100644 --- a/pkgs/development/compilers/llvm/10/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/10/libcxxabi/default.nix @@ -42,11 +42,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 ''; diff --git a/pkgs/development/compilers/llvm/11/libcxxabi/default.nix b/pkgs/development/compilers/llvm/11/libcxxabi/default.nix index 6c4ca925ab1..2359820ddde 100644 --- a/pkgs/development/compilers/llvm/11/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/11/libcxxabi/default.nix @@ -46,11 +46,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 ''; diff --git a/pkgs/development/compilers/llvm/12/libcxxabi/default.nix b/pkgs/development/compilers/llvm/12/libcxxabi/default.nix index 89b56ad230d..c130a6c1c31 100644 --- a/pkgs/development/compilers/llvm/12/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/12/libcxxabi/default.nix @@ -44,11 +44,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 ''; diff --git a/pkgs/development/compilers/llvm/13/libcxxabi/default.nix b/pkgs/development/compilers/llvm/13/libcxxabi/default.nix index 16ea0b113c7..5da86b96d5a 100644 --- a/pkgs/development/compilers/llvm/13/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/13/libcxxabi/default.nix @@ -41,11 +41,21 @@ stdenv.mkDerivation rec { 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 ''; diff --git a/pkgs/development/compilers/llvm/14/libcxxabi/default.nix b/pkgs/development/compilers/llvm/14/libcxxabi/default.nix index d64708ab040..0487f1d0de8 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 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 ''; diff --git a/pkgs/development/compilers/llvm/6/libcxxabi/default.nix b/pkgs/development/compilers/llvm/6/libcxxabi/default.nix index d7de130fbaa..63e6eee6f59 100644 --- a/pkgs/development/compilers/llvm/6/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/6/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 ''; diff --git a/pkgs/development/compilers/llvm/7/libcxxabi/default.nix b/pkgs/development/compilers/llvm/7/libcxxabi/default.nix index 1bc9444feda..721200136a5 100644 --- a/pkgs/development/compilers/llvm/7/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/7/libcxxabi/default.nix @@ -46,11 +46,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 ''; diff --git a/pkgs/development/compilers/llvm/8/libcxxabi/default.nix b/pkgs/development/compilers/llvm/8/libcxxabi/default.nix index 50a5eabc170..5ade8a5ae66 100644 --- a/pkgs/development/compilers/llvm/8/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/8/libcxxabi/default.nix @@ -42,11 +42,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 ''; diff --git a/pkgs/development/compilers/llvm/9/libcxxabi/default.nix b/pkgs/development/compilers/llvm/9/libcxxabi/default.nix index ee6834affbc..4a235f5c2ef 100644 --- a/pkgs/development/compilers/llvm/9/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/9/libcxxabi/default.nix @@ -42,11 +42,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 ''; diff --git a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix index 2d4fe974c01..b478668ebde 100644 --- a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix @@ -70,11 +70,21 @@ stdenv.mkDerivation rec { 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 ''; |