Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions pkgs/development/interpreters/perl/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ let
EOF
'' + optionalString stdenv.isDarwin ''
substituteInPlace hints/darwin.sh --replace "env MACOSX_DEPLOYMENT_TARGET=10.3" ""
'' + optionalString (!enableThreading) ''
# We need to do this because the bootstrap doesn't have a static libpthread
sed -i 's,\(libswanted.*\)pthread,\1,g' Configure
'';

# Default perl does not support --host= & co.
Expand Down
44 changes: 27 additions & 17 deletions pkgs/stdenv/linux/bootstrap-tools/scripts/unpack-bootstrap-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,42 @@ echo Patching the bootstrap tools...

if test -f $out/lib/ld.so.?; then
# MIPS case
LD_BINARY=$out/lib/ld.so.?
LD_BINARY=lib/ld.so.?
elif test -f $out/lib/ld64.so.?; then
# ppc64(le)
LD_BINARY=$out/lib/ld64.so.?
LD_BINARY=lib/ld64.so.?
else
# i686, x86_64 and armv5tel
LD_BINARY=$out/lib/ld-*so.?
LD_BINARY=lib/ld-*so.?
fi

# On x86_64, ld-linux-x86-64.so.2 barfs on patchelf'ed programs. So
# use a copy of patchelf.
LD_LIBRARY_PATH=$out/lib $LD_BINARY $out/bin/cp $out/bin/patchelf .
# make a copy of patchelf and lib so we don't try patchelf'ing
# patchelf itself, or a library that patchelf itself links against --
# this may cause segfaults due to lazy loading of binary images
LD_LIBRARY_PATH=$out/lib $out/$LD_BINARY $out/bin/cp -r $out/lib $out/bin/patchelf .

for i in $out/bin/* $out/libexec/gcc/*/*/*; do
if [ -L "$i" ]; then continue; fi
if [ -z "${i##*/liblto*}" ]; then continue; fi
echo patching "$i"
LD_LIBRARY_PATH=$out/lib $LD_BINARY \
./patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath "$i"
done
export LD_LIBRARY_PATH=lib
for i in $($LD_BINARY $out/bin/find $out -type f -executable); do

interp=$($LD_BINARY ./patchelf --print-interpreter $i 2>/dev/null || echo)

# patchelf --set-interpreter only if a nuke-ref'd interpreter is found
if [ -n "${interp}" ] && [ -z "${interp##/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-*/lib*/*}" ]; then
echo patching interpreter of "$i"
$LD_BINARY ./patchelf --set-interpreter $out/$LD_BINARY "$i"
fi

rpath=$($LD_BINARY ./patchelf --print-rpath $i 2>/dev/null || echo)

for i in $out/lib/librt-*.so $out/lib/libpcre*; do
if [ -L "$i" ]; then continue; fi
echo patching "$i"
$out/bin/patchelf --set-rpath $out/lib --force-rpath "$i"
# patchelf --set-rpath only if a nuke-ref'd rpath is found
if [ -n "${rpath}" ] && [ -z "${rpath##/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-*}" ] &&
# do not use patchelf --set-rpath on libgcc_s.so.1, because its rpath leaks into stdenv-final
[ -n "${i##*/lib*/libgcc_s.so.*}" ]; then
echo patching rpath of "$i"
$LD_BINARY ./patchelf --set-rpath $out/lib --force-rpath "$i"
fi
done
export LD_LIBRARY_PATH=

export PATH=$out/bin

Expand Down
7 changes: 0 additions & 7 deletions pkgs/stdenv/linux/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,6 @@ in
gcc-unwrapped coreutils gnugrep;

${localSystem.libc} = getLibc prevStage;

# A threaded perl build needs glibc/libpthread_nonshared.a,
# which is not included in bootstrapTools, so disable threading.
# This is not an issue for the final stdenv, because this perl
# won't be included in the final stdenv and won't be exported to
# top-level pkgs as an override either.
perl = super.perl.override { enableThreading = false; };
};
})

Expand Down