gcc: fix building darwin->linux cross compiler

This reverts d9feea5 with some slight modifications to work with
other changes since then.

Fixes #88213.
This commit is contained in:
Gaelan Steele
2020-05-26 03:16:03 -07:00
parent b0b0a06788
commit 459c60dda2
7 changed files with 65 additions and 37 deletions
+11 -1
View File
@@ -240,7 +240,7 @@ postInstall() {
# More dependencies with the previous gcc or some libs (gccbug stores the build command line)
rm -rf $out/bin/gccbug
if type "patchelf"; then
if [[ buildConfig == *"linux"* ]]; then
# Take out the bootstrap-tools from the rpath, as it's not needed at all having $out
for i in $(find "$out"/libexec/gcc/*/*/* -type f -a \! -name '*.la'); do
PREV_RPATH=`patchelf --print-rpath "$i"`
@@ -249,6 +249,16 @@ postInstall() {
done
fi
if [[ targetConfig == *"linux"* ]]; then
# For some reason, when building for linux on darwin, the libs retain
# RPATH to $out.
for i in "$lib"/"$targetConfig"/lib/{libtsan,libasan,libubsan}.so.*.*.*; do
PREV_RPATH=`patchelf --print-rpath "$i"`
NEW_RPATH=`echo "$PREV_RPATH" | sed "s,:${out}[^:]*,,g"`
patchelf --set-rpath "$NEW_RPATH" "$i" && echo OK
done
fi
if type "install_name_tool"; then
for i in "$lib"/lib/*.*.dylib; do
install_name_tool -id "$i" "$i" || true