关于在CentOS-6.5上安装gcc-6。*的问题

每个人每天都在为你的注意力而战。

我是一个新手,并且在我的全新的centos-6.5主机上安装gcc-6时遇到了问题,这让我疯了。

如你所知,CentOS-6.5上的默认gcc版本是4.4.7,不支持c ++ 11,所以我试着安装最新版本。

安装mpc-1.0.3,gmp-6.1.1,mpfr-3.1.4和isl-1.6后,安装gcc-6.2时出现错误。

表明:

checking for suffix of object files... configure: error: in `/root/Downloads/objdir-gcc-6.2.0/x86_64-pc-linux-gnu/libgcc': configure: error: cannot compute suffix of object files: cannot compile See `config.log' for more details. make[2]: *** [configure-stage1-target-libgcc] Error 1 make[2]: Leaving directory `/root/Downloads/objdir-gcc-6.2.0' make[1]: *** [stage1-bubble] Error 2 make[1]: Leaving directory `/root/Downloads/objdir-gcc-6.2.0' make: *** [all] Error 2 

正如在这个维基页面, 在这里input链接描述 ,也许我应该检查一些依赖的库。

然后我试着重复安装mpc,mpfr,gmp和gcc的老版本,但是同样的错误发生了。

我也检查了config.log,但没有find线索。

所以我在这里发布一个线索的任何帮助。 感谢!

对于其他的东西(即命令,结果和日志)可以帮助发布如下:

[root @ 192 objdir-gcc-6.2.0]#../gcc-6.2.0/configure –prefix = / home / gcc-6.2.0 –disable-multilib –disable-libada –with-gmp = / usr / local –with-mpc = / usr / local –with-mpfr = / usr / local

 checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c checking whether ln works... yes checking whether ln -s works... yes checking for a sed that does not truncate output... /bin/sed checking for gawk... gawk checking for libatomic support... yes checking for libcilkrts support... yes checking for libitm support... yes checking for libsanitizer support... yes checking for libvtv support... yes checking for libmpx support... yes checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking whether g++ accepts -static-libstdc++ -static-libgcc... no checking for gnatbind... no checking for gnatmake... no checking whether compiler driver understands Ada... no checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2 checking for objdir... .libs checking for the correct version of gmp.h... yes checking for the correct version of mpfr.h... yes checking for the correct version of mpc.h... yes checking for the correct version of the gmp/mpfr/mpc libraries... yes checking for isl 0.16, 0.15, or deprecated 0.14... yes checking for isl 0.16 or 0.15... yes The following languages will be built: c,c++,fortran,java,lto,objc *** This configuration is not supported in the following subdirectories: gnattools gotools target-libada target-libgo target-liboffloadmic (Any other directories should still work fine.) checking for default BUILD_CONFIG... bootstrap-debug checking for --enable-vtable-verify... no checking for bison... bison -y checking for bison... bison checking for gm4... no checking for gnum4... no checking for m4... m4 checking for flex... flex checking for flex... flex checking for makeinfo... makeinfo checking for expect... no checking for runtest... no checking for ar... ar checking for as... as checking for dlltool... no checking for ld... ld checking for lipo... no checking for nm... nm checking for ranlib... ranlib checking for strip... strip checking for windres... no checking for windmc... no checking for objcopy... objcopy checking for objdump... objdump checking for readelf... readelf checking for cc... cc checking for c++... c++ checking for gcc... gcc checking for gcj... no checking for gfortran... gfortran checking for gccgo... no checking for ar... no checking for ar... ar checking for as... no checking for as... as checking for dlltool... no checking for dlltool... no checking for ld... no checking for ld... ld checking for lipo... no checking for lipo... no checking for nm... no checking for nm... nm checking for objcopy... no checking for objcopy... objcopy checking for objdump... no checking for objdump... objdump checking for ranlib... no checking for ranlib... ranlib checking for readelf... no checking for readelf... readelf checking for strip... no checking for strip... strip checking for windres... no checking for windres... no checking for windmc... no checking for windmc... no checking where to find the target ar... host tool checking where to find the target as... host tool checking where to find the target cc... just compiled checking where to find the target c++... just compiled checking where to find the target c++ for libstdc++... just compiled checking where to find the target dlltool... host tool checking where to find the target gcc... just compiled checking where to find the target gcj... just compiled checking where to find the target gfortran... just compiled checking where to find the target gccgo... host tool checking where to find the target ld... host tool checking where to find the target lipo... host tool checking where to find the target nm... host tool checking where to find the target objcopy... host tool checking where to find the target objdump... host tool checking where to find the target ranlib... host tool checking where to find the target readelf... host tool checking where to find the target strip... host tool checking where to find the target windres... host tool checking where to find the target windmc... host tool checking whether to enable maintainer-specific portions of Makefiles... no configure: creating ./config.status config.status: creating Makefile 

[root @ 192 objdir-gcc-6.2.0]#make

 ...... make[3]: Leaving directory `/root/Downloads/objdir-gcc-6.2.0/gcc' mkdir -p -- x86_64-pc-linux-gnu/libgcc Checking multilib configuration for libgcc... Configuring stage 1 in x86_64-pc-linux-gnu/libgcc configure: creating cache ./config.cache checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking for --enable-version-specific-runtime-libs... no checking for a BSD-compatible install... /usr/bin/install -c checking for gawk... gawk checking for x86_64-pc-linux-gnu-ar... ar checking for x86_64-pc-linux-gnu-lipo... lipo checking for x86_64-pc-linux-gnu-nm... /root/Downloads/objdir-gcc-6.2.0/./gcc/nm checking for x86_64-pc-linux-gnu-ranlib... ranlib checking for x86_64-pc-linux-gnu-strip... strip checking whether ln -s works... yes checking for x86_64-pc-linux-gnu-gcc... /root/Downloads/objdir-gcc-6.2.0/./gcc/xgcc -B/root/Downloads/objdir-gcc-6.2.0/./gcc/ -B/home/gcc-6.2.0/x86_64-pc-linux-gnu/bin/ -B/home/gcc-6.2.0/x86_64-pc-linux-gnu/lib/ -isystem /home/gcc-6.2.0/x86_64-pc-linux-gnu/include -isystem /home/gcc-6.2.0/x86_64-pc-linux-gnu/sys-include checking for suffix of object files... configure: error: in `/root/Downloads/objdir-gcc-6.2.0/x86_64-pc-linux-gnu/libgcc': configure: error: cannot compute suffix of object files: cannot compile See `config.log' for more details. make[2]: *** [configure-stage1-target-libgcc] Error 1 make[2]: Leaving directory `/root/Downloads/objdir-gcc-6.2.0' make[1]: *** [stage1-bubble] Error 2 make[1]: Leaving directory `/root/Downloads/objdir-gcc-6.2.0' make: *** [all] Error 2 

[root @ 192 objdir-gcc-6.2.0]#ll / usr / local / lib | grep -E'gmp | mpc | mpfr | isl'

 -rw-r--r--. 1 root root 1297920 Sep 2 15:04 libgmp.a -rwxr-xr-x. 1 root root 913 Sep 2 15:04 libgmp.la lrwxrwxrwx. 1 root root 16 Sep 2 15:04 libgmp.so -> libgmp.so.10.3.1 lrwxrwxrwx. 1 root root 16 Sep 2 15:04 libgmp.so.10 -> libgmp.so.10.3.1 -rwxr-xr-x. 1 root root 529990 Sep 2 15:04 libgmp.so.10.3.1 -rw-r--r--. 1 root root 3460656 Sep 1 23:25 libisl.a -rwxr-xr-x. 1 root root 923 Sep 1 23:25 libisl.la lrwxrwxrwx. 1 root root 16 Sep 1 23:25 libisl.so -> libisl.so.15.1.0 lrwxrwxrwx. 1 root root 16 Sep 1 23:25 libisl.so.15 -> libisl.so.15.1.0 -rwxr-xr-x. 1 root root 1968767 Sep 1 23:25 libisl.so.15.1.0 -rw-r--r--. 1 root root 3939 Sep 1 23:25 libisl.so.15.1.0-gdb.py -rw-r--r--. 1 root root 202398 Sep 3 13:56 libmpc.a -rwxr-xr-x. 1 root root 942 Sep 3 13:56 libmpc.la lrwxrwxrwx. 1 root root 15 Sep 3 13:56 libmpc.so -> libmpc.so.2.0.0 lrwxrwxrwx. 1 root root 15 Sep 3 13:56 libmpc.so.2 -> libmpc.so.2.0.0 -rwxr-xr-x. 1 root root 89669 Sep 3 13:56 libmpc.so.2.0.0 lrwxrwxrwx. 1 root root 15 Sep 1 22:51 libmpc.so.3 -> libmpc.so.3.0.0 -rwxr-xr-x. 1 root root 108035 Sep 1 22:51 libmpc.so.3.0.0 -rw-r--r--. 1 root root 931342 Sep 1 22:41 libmpfr.a -rwxr-xr-x. 1 root root 946 Sep 1 22:41 libmpfr.la lrwxrwxrwx. 1 root root 16 Sep 1 22:41 libmpfr.so -> libmpfr.so.4.1.4 lrwxrwxrwx. 1 root root 16 Sep 1 22:41 libmpfr.so.4 -> libmpfr.so.4.1.4 -rwxr-xr-x. 1 root root 424265 Sep 1 22:41 libmpfr.so.4.1.4 

[root @ 192 objdir-gcc-6.2.0]#ll / usr / local / include | grep -E'gmp | mpc | mpfr | isl''

 -rw-r--r--. 1 root root 83934 Sep 2 15:04 gmp.h drwxr-xr-x. 3 root root 4096 Sep 1 23:25 isl -rw-r--r--. 1 root root 13049 Sep 3 13:56 mpc.h -rw-r--r--. 1 root root 6236 Sep 1 22:41 mpf2mpfr.h -rw-r--r--. 1 root root 51307 Sep 1 22:41 mpfr.h 

[root @ 192 objdir-gcc-6.2.0]#vim config.log

 This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by configure, which was generated by GNU Autoconf 2.64. Invocation command line was $ ../gcc-6.2.0/configure --prefix=/home/gcc-6.2.0 --disable-multilib --disable-libada --with-gmp=/usr/local --with-mpc=/usr/local --with-mpfr=/usr/local ## --------- ## ## Platform. ## ## --------- ## hostname = 192.168.44.100 uname -m = x86_64 uname -r = 2.6.32-431.el6.x86_64 uname -s = Linux uname -v = #1 SMP Fri Nov 22 03:15:09 UTC 2013 /usr/bin/uname -p = unknown /bin/uname -X = unknown /bin/arch = x86_64 /usr/bin/arch -k = unknown /usr/convex/getsysinfo = unknown /usr/bin/hostinfo = unknown /bin/machine = unknown /usr/bin/oslevel = unknown /bin/universe = unknown PATH: /usr/lib64/qt-3.3/bin PATH: /usr/local/sbin PATH: /usr/sbin PATH: /sbin PATH: /usr/local/bin PATH: /usr/bin PATH: /bin PATH: /root/bin ## ----------- ## ## Core tests. ## ## ----------- ## configure:2297: checking build system type configure:2311: result: x86_64-pc-linux-gnu configure:2358: checking host system type configure:2371: result: x86_64-pc-linux-gnu configure:2391: checking target system type configure:2404: result: x86_64-pc-linux-gnu configure:2458: checking for a BSD-compatible install configure:2526: result: /usr/bin/install -c configure:2537: checking whether ln works configure:2559: result: yes configure:2563: checking whether ln -s works configure:2567: result: yes configure:2574: checking for a sed that does not truncate output configure:2638: result: /bin/sed configure:2647: checking for gawk configure:2663: found /usr/bin/gawk configure:2674: result: gawk configure:3210: checking for libatomic support configure:3220: result: yes configure:3229: checking for libcilkrts support configure:3239: result: yes configure:3267: checking for libitm support configure:3277: result: yes configure:3286: checking for libsanitizer support configure:3296: result: yes configure:3305: checking for libvtv support configure:3315: result: yes configure:3325: checking for libmpx support configure:3335: result: yes configure:4118: checking for gcc configure:4134: found /usr/bin/gcc configure:4145: result: gcc configure:4374: checking for C compiler version configure:4383: gcc --version >&5 gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17) Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. configure:4394: $? = 0 configure:4383: gcc -v >&5 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.7 20120313 (Red Hat 4.4.7-17) (GCC) configure:4394: $? = 0 configure:4383: gcc -V >&5 gcc: '-V' option must have argument configure:4394: $? = 1 configure:4383: gcc -qversion >&5 gcc: unrecognized option '-qversion' gcc: no input files configure:4394: $? = 1 configure:4414: checking for C compiler default output file name configure:4436: gcc conftest.c >&5 configure:4440: $? = 0 configure:4477: result: a.out configure:4493: checking whether the C compiler works configure:4502: ./a.out configure:4506: $? = 0 configure:4521: result: yes configure:4528: checking whether we are cross compiling configure:4530: result: no configure:4533: checking for suffix of executables configure:4540: gcc -o conftest conftest.c >&5 configure:4544: $? = 0 configure:4566: result: configure:4572: checking for suffix of object files configure:4594: gcc -c conftest.c >&5 configure:4598: $? = 0 configure:4619: result: o configure:4623: checking whether we are using the GNU C compiler configure:4642: gcc -c conftest.c >&5 configure:4642: $? = 0 configure:4651: result: yes configure:4660: checking whether gcc accepts -g configure:4680: gcc -c -g conftest.c >&5 configure:4680: $? = 0 configure:4721: result: yes configure:4738: checking for gcc option to accept ISO C89 configure:4802: gcc -c -g -O2 conftest.c >&5 configure:4802: $? = 0 configure:4815: result: none needed configure:4893: checking for g++ configure:4909: found /usr/bin/g++ configure:4920: result: g++ configure:4947: checking for C++ compiler version configure:4956: g++ --version >&5 g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17) Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. configure:4967: $? = 0 configure:4956: g++ -v >&5 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.7 20120313 (Red Hat 4.4.7-17) (GCC) configure:4967: $? = 0 configure:4956: g++ -V >&5 g++: '-V' option must have argument configure:4967: $? = 1 configure:4956: g++ -qversion >&5 g++: unrecognized option '-qversion' g++: no input files configure:4967: $? = 1 configure:4971: checking whether we are using the GNU C++ compiler configure:4990: g++ -c conftest.cpp >&5 configure:4990: $? = 0 configure:4999: result: yes configure:5008: checking whether g++ accepts -g configure:5028: g++ -c -g conftest.cpp >&5 configure:5028: $? = 0 configure:5069: result: yes configure:5118: checking whether g++ accepts -static-libstdc++ -static-libgcc configure:5135: g++ -o conftest -g -O2 -static-libstdc++ -static-libgcc conftest.cpp >&5 g++: unrecognized option '-static-libstdc++' conftest.cpp:11:2: error: #error -static-libstdc++ not implemented configure:5135: $? = 1 configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "" | #define PACKAGE_TARNAME "" | #define PACKAGE_VERSION "" | #define PACKAGE_STRING "" | #define PACKAGE_BUGREPORT "" | #define PACKAGE_URL "" | /* end confdefs.h. */ | | #if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) | #error -static-libstdc++ not implemented | #endif | int main() {} configure:5139: result: no configure:5200: checking for gnatbind configure:5230: result: no configure:5292: checking for gnatmake configure:5322: result: no configure:5341: checking whether compiler driver understands Ada configure:5364: result: no configure:5373: checking how to compare bootstrapped objects configure:5398: result: cmp --ignore-initial=16 $$f1 $$f2 configure:5458: checking for objdir configure:5473: result: .libs configure:5647: checking for the correct version of gmp.h configure:5667: gcc -c -g -O2 -I/usr/local/include -I/usr/local/include -I/usr/local/include conftest.c >&5 configure:5667: $? = 0 configure:5685: gcc -c -g -O2 -I/usr/local/include -I/usr/local/include -I/usr/local/include conftest.c >&5 configure:5685: $? = 0 configure:5686: result: yes configure:5702: checking for the correct version of mpfr.h configure:5720: gcc -c -g -O2 -I/usr/local/include -I/usr/local/include -I/usr/local/include conftest.c >&5 configure:5720: $? = 0 configure:5737: gcc -c -g -O2 -I/usr/local/include -I/usr/local/include -I/usr/local/include conftest.c >&5 configure:5737: $? = 0 configure:5738: result: yes configure:5755: checking for the correct version of mpc.h configure:5772: gcc -c -g -O2 -I/usr/local/include -I/usr/local/include -I/usr/local/include conftest.c >&5 configure:5772: $? = 0 configure:5788: gcc -c -g -O2 -I/usr/local/include -I/usr/local/include -I/usr/local/include conftest.c >&5 configure:5788: $? = 0 configure:5789: result: yes configure:5807: checking for the correct version of the gmp/mpfr/mpc libraries configure:5838: gcc -o conftest -g -O2 -I/usr/local/include -I/usr/local/include -I/usr/local/include conftest.c -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -lmpc -lmpfr -lgmp >&5 configure:5838: $? = 0 configure:5839: result: yes configure:6024: checking for isl 0.16, 0.15, or deprecated 0.14 configure:6037: gcc -o conftest -g -O2 -I/usr/local/include -I/usr/local/include -I/usr/local/include -lisl -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -lmpc -lmpfr -lgmp conftest.c -lisl -lgmp >&5 configure:6037: $? = 0 configure:6044: result: yes configure:6052: checking for isl 0.16 or 0.15 configure:6065: gcc -o conftest -g -O2 -I/usr/local/include -I/usr/local/include -I/usr/local/include -lisl -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -lmpc -lmpfr -lgmp conftest.c -lisl -lgmp >&5 configure:6065: $? = 0 configure:6072: result: yes ...... (the rest omiited) 

它解决了!

对于最后的尝试,我运行了GCC源代码目录下的./contrib/download_prerequisites脚本,而不是手动下载,编译和安装依赖的库,并且成功了!

顺便说一下,在运行'configure'脚本时,应该添加选项'-enable-language = c,c ++'来过滤java支持,否则它会报错'libgmp.a:could not read symbols:Bad价值“这是据说是关于Java语言支持。

感谢关注。