libcxx: Link libc++.dylib to matching libc++abi.dylib
Same adjustment as made for libc++abi in #185766, for the same reason: the unamended dylib links to the libc++abi in the build stdenv, which is the wrong version. Tested on Darwin with LLVM 14 stdenv, but the phase is added to all versions, including 11 - so this will cause a mass rebuild. See: https://github.com/NixOS/nixpkgs/pull/185766
This commit is contained in:
parent
8abde38a26
commit
67f11a2185
11 changed files with 154 additions and 0 deletions
|
@ -51,6 +51,20 @@ stdenv.mkDerivation {
|
||||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||||
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
|
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
|
||||||
|
|
||||||
|
preInstall = lib.optionalString (stdenv.isDarwin) ''
|
||||||
|
for file in lib/*.dylib; do
|
||||||
|
if [ -L "$file" ]; then continue; fi
|
||||||
|
|
||||||
|
baseName=$(basename $(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
|
||||||
|
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
|
||||||
|
done
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
isLLVM = true;
|
isLLVM = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -67,6 +67,20 @@ stdenv.mkDerivation {
|
||||||
stdenv.hostPlatform != stdenv.buildPlatform
|
stdenv.hostPlatform != stdenv.buildPlatform
|
||||||
) "-DCMAKE_SYSTEM_VERSION=20.1.0";
|
) "-DCMAKE_SYSTEM_VERSION=20.1.0";
|
||||||
|
|
||||||
|
preInstall = lib.optionalString (stdenv.isDarwin) ''
|
||||||
|
for file in lib/*.dylib; do
|
||||||
|
if [ -L "$file" ]; then continue; fi
|
||||||
|
|
||||||
|
baseName=$(basename $(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
|
||||||
|
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
|
||||||
|
done
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
isLLVM = true;
|
isLLVM = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,6 +42,20 @@ stdenv.mkDerivation {
|
||||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||||
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
|
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
|
||||||
|
|
||||||
|
preInstall = lib.optionalString (stdenv.isDarwin) ''
|
||||||
|
for file in lib/*.dylib; do
|
||||||
|
if [ -L "$file" ]; then continue; fi
|
||||||
|
|
||||||
|
baseName=$(basename $(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
|
||||||
|
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
|
||||||
|
done
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
isLLVM = true;
|
isLLVM = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,6 +46,20 @@ stdenv.mkDerivation rec {
|
||||||
buildFlags = lib.optional headersOnly "generate-cxx-headers";
|
buildFlags = lib.optional headersOnly "generate-cxx-headers";
|
||||||
installTargets = lib.optional headersOnly "install-cxx-headers";
|
installTargets = lib.optional headersOnly "install-cxx-headers";
|
||||||
|
|
||||||
|
preInstall = lib.optionalString (stdenv.isDarwin && !headersOnly) ''
|
||||||
|
for file in lib/*.dylib; do
|
||||||
|
if [ -L "$file" ]; then continue; fi
|
||||||
|
|
||||||
|
baseName=$(basename $(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
|
||||||
|
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
|
||||||
|
done
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
# At this point, cxxabi headers would be installed in the dev output, which
|
# At this point, cxxabi headers would be installed in the dev output, which
|
||||||
# prevents moveToOutput from doing its job later in the build process.
|
# prevents moveToOutput from doing its job later in the build process.
|
||||||
postInstall = lib.optionalString (!headersOnly) ''
|
postInstall = lib.optionalString (!headersOnly) ''
|
||||||
|
|
|
@ -62,6 +62,20 @@ stdenv.mkDerivation rec {
|
||||||
buildFlags = lib.optional headersOnly "generate-cxx-headers";
|
buildFlags = lib.optional headersOnly "generate-cxx-headers";
|
||||||
installTargets = lib.optional headersOnly "install-cxx-headers";
|
installTargets = lib.optional headersOnly "install-cxx-headers";
|
||||||
|
|
||||||
|
preInstall = lib.optionalString (stdenv.isDarwin && !headersOnly) ''
|
||||||
|
for file in lib/*.dylib; do
|
||||||
|
if [ -L "$file" ]; then continue; fi
|
||||||
|
|
||||||
|
baseName=$(basename $(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
|
||||||
|
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
|
||||||
|
done
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
isLLVM = true;
|
isLLVM = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,6 +41,20 @@ stdenv.mkDerivation {
|
||||||
"-DLIBCXX_CXX_ABI=libcxxabi"
|
"-DLIBCXX_CXX_ABI=libcxxabi"
|
||||||
] ++ lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1";
|
] ++ lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1";
|
||||||
|
|
||||||
|
preInstall = lib.optionalString (stdenv.isDarwin) ''
|
||||||
|
for file in lib/*.dylib; do
|
||||||
|
if [ -L "$file" ]; then continue; fi
|
||||||
|
|
||||||
|
baseName=$(basename $(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
|
||||||
|
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
|
||||||
|
done
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
isLLVM = true;
|
isLLVM = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,6 +47,20 @@ stdenv.mkDerivation {
|
||||||
"-DLIBCXX_CXX_ABI=libcxxabi"
|
"-DLIBCXX_CXX_ABI=libcxxabi"
|
||||||
] ++ lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1";
|
] ++ lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1";
|
||||||
|
|
||||||
|
preInstall = lib.optionalString (stdenv.isDarwin) ''
|
||||||
|
for file in lib/*.dylib; do
|
||||||
|
if [ -L "$file" ]; then continue; fi
|
||||||
|
|
||||||
|
baseName=$(basename $(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
|
||||||
|
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
|
||||||
|
done
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
isLLVM = true;
|
isLLVM = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -52,6 +52,20 @@ stdenv.mkDerivation {
|
||||||
++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
|
++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
|
||||||
++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF" ;
|
++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF" ;
|
||||||
|
|
||||||
|
preInstall = lib.optionalString (stdenv.isDarwin) ''
|
||||||
|
for file in lib/*.dylib; do
|
||||||
|
if [ -L "$file" ]; then continue; fi
|
||||||
|
|
||||||
|
baseName=$(basename $(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
|
||||||
|
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
|
||||||
|
done
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
isLLVM = true;
|
isLLVM = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -55,6 +55,20 @@ stdenv.mkDerivation {
|
||||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||||
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
|
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
|
||||||
|
|
||||||
|
preInstall = lib.optionalString (stdenv.isDarwin) ''
|
||||||
|
for file in lib/*.dylib; do
|
||||||
|
if [ -L "$file" ]; then continue; fi
|
||||||
|
|
||||||
|
baseName=$(basename $(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
|
||||||
|
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
|
||||||
|
done
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
isLLVM = true;
|
isLLVM = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -51,6 +51,20 @@ stdenv.mkDerivation {
|
||||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||||
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
|
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
|
||||||
|
|
||||||
|
preInstall = lib.optionalString (stdenv.isDarwin) ''
|
||||||
|
for file in lib/*.dylib; do
|
||||||
|
if [ -L "$file" ]; then continue; fi
|
||||||
|
|
||||||
|
baseName=$(basename $(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
|
||||||
|
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
|
||||||
|
done
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
isLLVM = true;
|
isLLVM = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -76,6 +76,20 @@ stdenv.mkDerivation rec {
|
||||||
buildFlags = lib.optional headersOnly "generate-cxx-headers";
|
buildFlags = lib.optional headersOnly "generate-cxx-headers";
|
||||||
installTargets = lib.optional headersOnly "install-cxx-headers";
|
installTargets = lib.optional headersOnly "install-cxx-headers";
|
||||||
|
|
||||||
|
preInstall = lib.optionalString (stdenv.isDarwin && !headersOnly) ''
|
||||||
|
for file in lib/*.dylib; do
|
||||||
|
if [ -L "$file" ]; then continue; fi
|
||||||
|
|
||||||
|
baseName=$(basename $(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
|
||||||
|
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
|
||||||
|
done
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
isLLVM = true;
|
isLLVM = true;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue