diff options
author | Sergei Trofimovich <slyich@gmail.com> | 2023-01-02 17:19:26 +0000 |
---|---|---|
committer | Sergei Trofimovich <slyich@gmail.com> | 2023-01-04 16:02:22 +0000 |
commit | b470a6b21293d0fa29d35f7e7ac180c5b0311e87 (patch) | |
tree | 4260c3a8109303d8651cd4a6f980b5bb6101b623 /pkgs/stdenv/linux/bootstrap-tools | |
parent | 5ce27e15eab11fb6d36d4004a55c06c02a837639 (diff) | |
download | nixpkgs-b470a6b21293d0fa29d35f7e7ac180c5b0311e87.tar nixpkgs-b470a6b21293d0fa29d35f7e7ac180c5b0311e87.tar.gz nixpkgs-b470a6b21293d0fa29d35f7e7ac180c5b0311e87.tar.bz2 nixpkgs-b470a6b21293d0fa29d35f7e7ac180c5b0311e87.tar.lz nixpkgs-b470a6b21293d0fa29d35f7e7ac180c5b0311e87.tar.xz nixpkgs-b470a6b21293d0fa29d35f7e7ac180c5b0311e87.tar.zst nixpkgs-b470a6b21293d0fa29d35f7e7ac180c5b0311e87.zip |
linux/bootstrap-tools: move libstdc++ out of default library search path
This change allows building new gcc during bootstrap without fear of pulling in outdated libstdc++.so after g++ switched from bootstrapTools to freshly built g++. Noticed when tried to add early bootstrap stage to rebuild `gcc` before `glibc` is fully untangled from `bootstrapTools` as a failure to built `binutils`: ld: dwp.o: in function `__gnu_cxx::new_allocator<gold::Dwp_output_file::Contribution>::allocate(unsigned long, void const*)': /nix/store/...-gcc-11.3.0/include/c++/11.3.0/ext/new_allocator.h:116: undefined reference to `std::__throw_bad_array_new_length()' The change survives existing bootstrap and unblockes early `gcc` bootstrap.
Diffstat (limited to 'pkgs/stdenv/linux/bootstrap-tools')
-rw-r--r-- | pkgs/stdenv/linux/bootstrap-tools/scripts/unpack-bootstrap-tools.sh | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/pkgs/stdenv/linux/bootstrap-tools/scripts/unpack-bootstrap-tools.sh b/pkgs/stdenv/linux/bootstrap-tools/scripts/unpack-bootstrap-tools.sh index f394869ea91..5b5677eef13 100644 --- a/pkgs/stdenv/linux/bootstrap-tools/scripts/unpack-bootstrap-tools.sh +++ b/pkgs/stdenv/linux/bootstrap-tools/scripts/unpack-bootstrap-tools.sh @@ -17,6 +17,15 @@ else LD_BINARY=$out/lib/ld-*so.? fi +# path to version-specific libraries, like libstdc++.so +LIBSTDCXX_SO_DIR=$(echo $out/lib/gcc/*/*) + +# Move version-specific libraries out to avoid library mix when we +# upgrade gcc. +# TODO(trofi): update bootstrap tarball script and tarballs to put them +# into expected location directly. +LD_LIBRARY_PATH=$out/lib $LD_BINARY $out/bin/mv $out/lib/libstdc++.* $LIBSTDCXX_SO_DIR/ + # 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 . @@ -25,8 +34,8 @@ 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" + LD_LIBRARY_PATH=$out/lib:$LIBSTDCXX_SO_DIR $LD_BINARY \ + ./patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib:$LIBSTDCXX_SO_DIR --force-rpath "$i" done for i in $out/lib/librt-*.so $out/lib/libpcre*; do |