I've tried to build GCC 4.9.3 and 5.2.0 from source on RHEL 6.2, but failed in stage1 with following error(the following is error for GCC5.2.0, and GCC4.9.3 will result in similar error): g++: fatal error: braced spec '%:sanitize(address):%{!shared:libasan_preinit%O%s} %{static-libasan:%{!shared:-Bstatic --whole-archive -lasan --no-whole-archive -Bdynamic}}%{!static-libasan:-lasan}} %{%:sanitize(thread):%{static-libtsan:%{!shared:-Bstatic --whole-archive -ltsan --no-whole-archive -Bdynamic}}%{!static-libtsan:-ltsan}} %{%:sanitize(leak):%{static-liblsan:%{!shared:-Bstatic --whole-archive -llsan --no-whole-archive -Bdynamic}}%{!static-liblsan:-llsan}}' is invalid at '%' compilation terminated. make[3]: *** [cc1] Error 1 make[3]: Leaving directory `/home/hbsally/hocode/gcc520build/gcc' make[2]: *** [all-stage1-gcc] Error 2 make[2]: Leaving directory `/home/hbsally/hocode/gcc520build' make[1]: *** [stage1-bubble] Error 2 make[1]: Leaving directory `/home/hbsally/hocode/gcc520build' make: *** [all] Error 2 I try to build them with both system GCC(version 4.4.6), and a GCC(version 4.8.4) compiled by myself, and they will result in same error. I run grep, and found the spec is from file ./gcc/specs. I compare it with gcc -dumpspecs, and found that both GCC4.4.6 and GCC4.8.4 using something like "%{fsanitize=thread:", while this file contains "%:sanitize(thread)". I try to run following command(this time, I compile GCC4.9.3 with system GCC4.4.6): gcc -dumpspecs > ./gcc/specs and then run make to continue compiling, it is OK now. The configure options when I compile GCC 4.9.3(similar for GCC 5.2.0): ../gcc-4.9.3/configure --prefix=/home/hbsally/hocode/apps/gcc-4.9.3 --disable-multilib --with-system-zlib --enable-languages=c,c++,fortran --disable-nls The system GCC version(gcc -v): Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) and the GCC 4.8.4 compiled by myself(gcc -v): Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/home/hbsally/hocode/apps/libexec/gcc/x86_64-unknown-linux-gnu/4.8.4/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-4.8.4/configure --prefix=/home/hbsally/hocode/apps --enable-languages=c,c++,fortran --disable-multilib Thread model: posix gcc version 4.8.4 (GCC) the system version(cat /etc/redhat-release): Red Hat Enterprise Linux Server release 6.2 (Santiago) and (uname -a): Linux login2 2.6.32-220.el6.x86_64 #1 SMP Wed Nov 9 08:03:13 EST 2011 x86_64 x86_64 x86_64 GNU/Linux I use GMP 5.1.3, MPFR 3.1.2, MPC 1.0.3, and no ISL. These three packages are placed in source directory of GCC, as the INSTALL documents said to bootstrap with GCC. I've successful build GCC4.8.4 with these three packages.
Can you provide the full log? Because I don't see how the specs file will ever be used here. That is unless gcc has passed -B. itself.
No feedback in over 4 years and I was able to build at GCC 7 on CentOS 6 (before I moved to CentOS 7).