From 723e813e4e67281a327c5abccf02145a1a91527a Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Fri, 14 Jun 2019 12:10:57 +0100 Subject: Binutils is built alone, before GCC Until now, on GNU/Linux systems, GNU Binutils was built in parallel with other programs. As a result, the moment that the Binutils executables (most importantly `ld') are being installed, if another program is using them, we can have a crash. For some reason, this crash doesn't happen on Fedora or Arch Linux, but on some Debian-based distors, it causes the following crash when we are building Git (which happened to be built while Binuntils is being installed): credential-cache--daemon.o: file not recognized: File format not recognized In a following run of `./configure' (when Binutils has been installed), Git will build and install successfully. To fix this problem, with this commit, all basic programs are now a prerequisite of Binutils and Binutils is the sole prerequisite of GCC (which is the final target of `basic.mk'). Also, the GCC configure options were re-ordered to be easier to read (the `--with-*' options under each other, the `--enable-*' options under each other and so on). --- reproduce/software/make/basic.mk | 95 +++++++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 40 deletions(-) (limited to 'reproduce/software/make/basic.mk') diff --git a/reproduce/software/make/basic.mk b/reproduce/software/make/basic.mk index 4620e6e..3ea1453 100644 --- a/reproduce/software/make/basic.mk +++ b/reproduce/software/make/basic.mk @@ -60,7 +60,7 @@ export CPPFLAGS := -I$(idir)/include $(CPPFLAGS) export LDFLAGS := $(rpath_command) -L$(ildir) $(LDFLAGS) # Define the top-level basic programs (that don't depend on any other). -top-level-programs = low-level-links wget metastore gcc +top-level-programs = low-level-links gcc all: $(foreach p, $(top-level-programs), $(ibidir)/$(p)) @@ -989,17 +989,52 @@ $(ibidir)/which: $(tdir)/which-$(which-version).tar.gz \ # GCC and its prerequisites # ------------------------- -# + +$(ibidir)/isl: $(tdir)/isl-$(isl-version).tar.bz2 \ + $(ibidir)/gmp + $(call gbuild, $<, isl-$(isl-version), static) \ + && echo "GNU Integer Set Library $(isl-version)" > $@ + +$(ibidir)/mpc: $(tdir)/mpc-$(mpc-version).tar.gz \ + $(ibidir)/mpfr + $(call gbuild, $<, mpc-$(mpc-version), static, , , make check) \ + && echo "GNU Multiple Precision Complex library" > $@ + # Binutils' assembler (`as') and linker (`ld') will conflict with other # compilers. So until then, on Mac systems we'll use the host opertating # system's Binutils equivalents by just making links. + +ifeq ($(host_cc),1) +gcc-prerequisites = +else +gcc-prerequisites = $(ibidir)/isl \ + $(ibidir)/mpc +endif + ifeq ($(on_mac_os),yes) -binutils-prerequisites = +binutils-tarball = else -binutils-prerequisites = $(tdir)/binutils-$(binutils-version).tar.lz \ - $(ibidir)/coreutils +binutils-tarball = $(tdir)/binutils-$(binutils-version).tar.lz endif -$(ibidir)/binutils: $(binutils-prerequisites) + +# The installation of Binutils can cause problems during the build of other +# programs (http://savannah.nongnu.org/bugs/?56294). Therefore, we'll set +# all other basic programs as Binutils prerequisite and GCC (the final +# basic target) ultimately just depends on Binutils. +$(ibidir)/binutils: $(binutils-tarball) \ + $(gcc-prerequisites) \ + $(ibidir)/metastore \ + $(ibidir)/findutils \ + $(ibidir)/diffutils \ + $(ibidir)/coreutils \ + $(ibidir)/glibtool \ + $(ibidir)/which \ + $(ibidir)/wget \ + $(ibidir)/grep \ + $(ibidir)/file \ + $(ibidir)/gawk \ + $(ibidir)/sed + if [ x$(on_mac_os) = xyes ]; then \ $(call makelink,as); \ $(call makelink,ar); \ @@ -1013,16 +1048,6 @@ $(ibidir)/binutils: $(binutils-prerequisites) && echo "GNU Binutils $(binutils-version)" > $@; \ fi -$(ibidir)/isl: $(tdir)/isl-$(isl-version).tar.bz2 \ - $(ibidir)/gmp - $(call gbuild, $<, isl-$(isl-version), static) \ - && echo "GNU Integer Set Library $(isl-version)" > $@ - -$(ibidir)/mpc: $(tdir)/mpc-$(mpc-version).tar.gz \ - $(ibidir)/mpfr - $(call gbuild, $<, mpc-$(mpc-version), static, , , make check) \ - && echo "GNU Multiple Precision Complex library" > $@ - # We are having issues with `libiberty' (part of GCC) on Mac. So for now, # GCC won't be built there. Since almost no natural science paper's # processing depends so strongly on the compiler used, for now, this isn't @@ -1037,22 +1062,12 @@ $(ibidir)/mpc: $(tdir)/mpc-$(mpc-version).tar.gz \ # We are currently having problems installing GCC on macOS, so for the time # being, if the project is being run on a macOS, we'll just set a link. ifeq ($(host_cc),1) -gcc-prerequisites = +gcc-tarball = else -gcc-prerequisites = $(tdir)/gcc-$(gcc-version).tar.xz \ - $(ibidir)/isl \ - $(ibidir)/mpc +gcc-tarball = $(tdir)/gcc-$(gcc-version).tar.xz endif -$(ibidir)/gcc: $(gcc-prerequisites) \ - $(ibidir)/sed \ - $(ibidir)/file \ - $(ibidir)/gawk \ - $(ibidir)/grep \ - $(ibidir)/which \ - $(ibidir)/glibtool \ - $(ibidir)/binutils \ - $(ibidir)/diffutils \ - $(ibidir)/findutils +$(ibidir)/gcc: $(gcc-tarball) \ + $(ibidir)/binutils # GCC builds is own libraries in '$(idir)/lib64'. But all other # libraries are in '$(idir)/lib'. Since this project is only for a @@ -1083,23 +1098,23 @@ $(ibidir)/gcc: $(gcc-prerequisites) \ && ../configure SHELL=$(ibdir)/bash \ --prefix=$(idir) \ --with-mpc=$(idir) \ - --with-mpfr=$(idir) \ --with-gmp=$(idir) \ --with-isl=$(idir) \ + --with-mpfr=$(idir) \ + --with-local-prefix=$(idir) \ --with-build-time-tools=$(idir) \ - --enable-shared \ --enable-lto \ - --disable-multilib \ - --disable-multiarch \ - --enable-threads=posix \ - --with-local-prefix=$(idir) \ - --enable-languages=c,c++,fortran,objc,obj-c++ \ - --disable-libada \ - --disable-nls \ + --enable-shared \ + --enable-cet=auto \ --enable-default-pie \ --enable-default-ssp \ - --enable-cet=auto \ --enable-decimal-float \ + --enable-threads=posix \ + --enable-languages=c,c++,fortran,objc,obj-c++ \ + --disable-nls \ + --disable-libada \ + --disable-multilib \ + --disable-multiarch \ && make SHELL=$(ibdir)/bash -j$(numthreads) \ && make SHELL=$(ibdir)/bash install \ && cd ../.. \ -- cgit v1.2.1