Bug 1451104 - part 1 - be explicit about our GCC/binutils target and build machine; r=glandium
authorNathan Froyd <froydnj@gmail.com>
Fri, 15 Mar 2019 01:28:10 +0000
changeset 521992 468eed96e879
parent 521991 9d33ee85f2d4
child 521993 961ac7318786
push id10870
push usernbeleuzu@mozilla.com
push dateFri, 15 Mar 2019 20:00:07 +0000
treeherdermozilla-beta@c594aee5b7a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1451104
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1451104 - part 1 - be explicit about our GCC/binutils target and build machine; r=glandium Explicit is better than implicit, and helps ensure that GCC is always using the binutils we built it with, rather than the system binutils. Differential Revision: https://phabricator.services.mozilla.com/D22879
build/unix/build-gcc/build-gcc.sh
--- a/build/unix/build-gcc/build-gcc.sh
+++ b/build/unix/build-gcc/build-gcc.sh
@@ -34,32 +34,39 @@ build_binutils() {
   # if binutils_configure_flags is not set at all, give it the default value
   if [ -z "${binutils_configure_flags+xxx}" ];
   then
     # gold is disabled because we don't use it on automation, and also we ran into
     # some issues with it using this script in build-clang.py.
     #
     # --enable-targets builds extra target support in ld.
     # Enabling aarch64 support brings in arm support, so we don't need to specify that too.
-    binutils_configure_flags="--enable-targets=aarch64-unknown-linux-gnu --disable-gold --enable-plugins --disable-nls --with-sysroot=/"
+    #
+    # It is important to have the binutils --target and the gcc --target match,
+    # so binutils will install binaries in a place that gcc will look for them.
+    binutils_configure_flags="--enable-targets=aarch64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu --target=x86_64-unknown-linux-gnu --disable-gold --enable-plugins --disable-nls --with-sysroot=/"
   fi
 
   mkdir $root_dir/binutils-objdir
   pushd $root_dir/binutils-objdir
   ../binutils-$binutils_version/configure --prefix=${prefix-/tools/gcc}/ $binutils_configure_flags
   make $make_flags
   make install $make_flags DESTDIR=$root_dir
   export PATH=$root_dir/${prefix-/tools/gcc}/bin:$PATH
   popd
 }
 
 build_gcc() {
+  # Be explicit about --build and --target so header and library install
+  # directories are consistent.
+  local target="${1:-x86_64-unknown-linux-gnu}"
+
   mkdir $root_dir/gcc-objdir
   pushd $root_dir/gcc-objdir
-  ../gcc-$gcc_version/configure --prefix=${prefix-/tools/gcc} --enable-languages=c,c++  --disable-nls --disable-gnu-unique-object --enable-__cxa_atexit --with-arch-32=pentiumpro --with-sysroot=/
+  ../gcc-$gcc_version/configure --prefix=${prefix-/tools/gcc} --build=x86_64-unknown-linux-gnu --target="${target}" --enable-languages=c,c++  --disable-nls --disable-gnu-unique-object --enable-__cxa_atexit --with-arch-32=pentiumpro --with-sysroot=/
   make $make_flags
   make $make_flags install DESTDIR=$root_dir
 
   cd $root_dir/tools
   ln -s gcc gcc/bin/cc
 
   tar caf $root_dir/gcc.tar.xz gcc/
   popd