From 23e26355b11ce562dc7f9c4ad85b78e4b7c60f83 Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Fri, 26 Jul 2019 01:17:57 +0100 Subject: PatchELF built statically and updated Until now, like all other software, PatchELF would install with dynamic linking. However, PatchELF links with `libstdc++' so on one system, I noticed that PatchELF gives a segmentation fault and corrupts `libstdc++' while correcting its RPATH (after installing GCC). The solution is to build PatchELF statically. With this commit, we force PatchELF to be built statically (it only installs on GNU/Linux systems anyway, so there is no problem with static linking on macOS). This solved the problem on that system. While looking at its documentation, I also noticed that a new version of PatchELF has been released after almost three years, so it has been updated in the template also. This fixes bug #56673. --- reproduce/software/make/basic.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'reproduce/software/make') diff --git a/reproduce/software/make/basic.mk b/reproduce/software/make/basic.mk index 5535019..e544234 100644 --- a/reproduce/software/make/basic.mk +++ b/reproduce/software/make/basic.mk @@ -519,8 +519,14 @@ $(ibidir)/readline: $(tdir)/readline-$(readline-version).tar.gz \ SHLIB_LIBS="-lncursesw" -j$(numthreads)) \ && echo "GNU Readline $(readline-version)" > $@ +# Patchelf has to be built statically because it links with the C++ +# standard library. Therefore while fixing rpath in `libstdc++' with +# Patchelf we can have a segmentation fault. Note that Patchelf is only for +# GNU/Linux systems, so there is no problem with having the `-static' flag +# in LDFLAGS. $(ibidir)/patchelf: $(tdir)/patchelf-$(patchelf-version).tar.gz \ $(ibidir)/make + export LDFLAGS="$$LDFLAGS -static"; \ $(call gbuild, $<, patchelf-$(patchelf-version), static) \ && echo "PatchELF $(patchelf-version)" > $@ @@ -1153,7 +1159,7 @@ $(ibidir)/gcc: $(gcc-tarball) \ && cd ../.. \ && rm -rf gcc-$(gcc-version) \ && if [ "x$(on_mac_os)" != xyes ]; then \ - for f in $$(find $(idir)/libexec/gcc) $(ildir)/libstdc++**; do \ + for f in $$(find $(idir)/libexec/gcc) $(ildir)/libstdc++*; do \ if ldd $$f &> /dev/null; then \ patchelf --set-rpath $(ildir) $$f; \ fi; \ -- cgit v1.2.1