參考:
https://www.cnblogs.com/damonxu/p/6434265.html
http://blog.csdn.net/striker_v/article/details/51920627
https://www.cnblogs.com/Norlan/p/5196920.html
tips:
如果不能科學上網,那么ftp是訪問不了的,可以直接把ftp三個字母換成http,親測有效。
安裝
#su #cd /opt #wget http://ftp.gnu.org/gnu/gcc/gcc-5.3.0/gcc-5.3.0.tar.gz
安裝前置
你的編譯器告訴你還需要GMP啊,等等,就是說你需要前置的三個安裝包。
然后按照:
https://www.cnblogs.com/damonxu/p/6434265.html
的方法把ftp統統改成http進行安裝。
每安裝完一個都要用
make check
看下安裝情況
5.4降到5.3的安裝
../gcc-5.3.0/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib --with-gmp=/usr/local/gmp-4.3.2 --with-mpfr=/usr/local/mpfr-2.4.2 --with-mpc=/usr/local/mpc-0.8.1
這個前面的..請換成你的gcc解壓包的路徑,絕對的或者相對的都可以。
錯誤錦集:
就是之前說的,make check。安裝gmp時,作者提示強烈建議運行sudo make check
- 檢查下有沒有錯誤。然后我就出現了如下錯誤。這句命令以上博客都沒有提到。
1 of 58 tests failed Please report to gmp-bugs@gmplib.org ==================================== Makefile:1004: recipe for target 'check-TESTS' failed make[4]: *** [check-TESTS] Error 1 make[4]: Leaving directory '/usr/local/gmp-4.3.2/tests/mpz' Makefile:1104: recipe for target 'check-am' failed make[3]: *** [check-am] Error 2 make[3]: Leaving directory '/usr/local/gmp-4.3.2/tests/mpz' Makefile:505: recipe for target 'check-recursive' failed make[2]: *** [check-recursive] Error 1 make[2]: Leaving directory '/usr/local/gmp-4.3.2/tests' Makefile:925: recipe for target 'check-recursive' failed make[1]: *** [check-recursive] Error 1 make[1]: Leaving directory '/usr/local/gmp-4.3.2' Makefile:1183: recipe for target 'check' failed make: *** [check] Error 2
相關錯誤只有這里:
https://gmplib.org/list-archives/gmp-bugs/2013-November/003225.html
找到了,鑒於還是安裝上了,所以暫時不管。
- 之后全部走完該安裝gcc了,在make 的時候出現了如下錯誤:
checking for x86_64-unknown-linux-gnu-gcc... /usr/local/gcc-5.3.0/./gcc/xgcc -B/usr/local/gcc-5.3.0/./gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include checking for suffix of object files... configure: error: in `/usr/local/gcc-5.3.0/x86_64-unknown-linux-gnu/libgcc': configure: error: cannot compute suffix of object files: cannot compile See `config.log' for more details. Makefile:16229: recipe for target 'configure-stage1-target-libgcc' failed make[2]: *** [configure-stage1-target-libgcc] Error 1 make[2]: Leaving directory '/usr/local/gcc-5.3.0' Makefile:20383: recipe for target 'stage1-bubble' failed make[1]: *** [stage1-bubble] Error 2 make[1]: Leaving directory '/usr/local/gcc-5.3.0' Makefile:902: recipe for target 'all' failed make: *** [all] Error 2
然后我檢查了日志
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
conftest.c:10:21: fatal error: isl/val.h: No such file or directory
configure:4074: checking for gcc configure:4090: found /usr/bin/gcc configure:4101: result: gcc configure:4330: checking for C compiler version configure:4339: gcc --version >&5 gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 Copyright (C) 2015 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:4350: $? = 0 configure:4339: gcc -v >&5 Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.9' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9) configure:4350: $? = 0 configure:4339: gcc -V >&5 gcc: error: unrecognized command line option '-V' gcc: fatal error: no input files compilation terminated. configure:4350: $? = 1 configure:4339: gcc -qversion >&5 gcc: error: unrecognized command line option '-qversion' gcc: fatal error: no input files compilation terminated. configure:4350: $? = 1 configure:4370: checking for C compiler default output file name configure:4392: gcc conftest.c >&5 configure:4396: $? = 0 configure:4433: result: a.out configure:4449: checking whether the C compiler works configure:4458: ./a.out configure:4462: $? = 0 configure:4477: result: yes configure:4484: checking whether we are cross compiling configure:4486: result: no configure:4489: checking for suffix of executables configure:4496: gcc -o conftest conftest.c >&5 configure:4500: $? = 0 configure:4522: result: configure:4528: checking for suffix of object files configure:4550: gcc -c conftest.c >&5 configure:4554: $? = 0 configure:4575: result: o configure:4579: checking whether we are using the GNU C compiler configure:4598: gcc -c conftest.c >&5 configure:4598: $? = 0 configure:4607: result: yes configure:4616: checking whether gcc accepts -g configure:4636: gcc -c -g conftest.c >&5 configure:4636: $? = 0 configure:4677: result: yes configure:4694: checking for gcc option to accept ISO C89 configure:4758: gcc -c -g -O2 conftest.c >&5 configure:4758: $? = 0 configure:4771: result: none needed configure:4849: checking for g++ configure:4865: found /usr/bin/g++ configure:4876: result: g++ configure:4903: checking for C++ compiler version configure:4912: g++ --version >&5 g++ (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 Copyright (C) 2015 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:4923: $? = 0 configure:4912: g++ -v >&5 Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.9' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9) configure:4923: $? = 0 configure:4912: g++ -V >&5 g++: error: unrecognized command line option '-V' g++: fatal error: no input files compilation terminated. configure:4923: $? = 1 configure:4912: g++ -qversion >&5 g++: error: unrecognized command line option '-qversion' g++: fatal error: no input files compilation terminated.
對於安裝到一半錯了,我的辦法是直接刪除安裝文件夾,然后看看差什么,重新開始
- 首先,整了下路徑:
export LD_LIBRARY_PATH=/opt/gmp-5.0.1/lib:/opt/mpfr-3.1.4/lib/:/opt/mpc-1.0:$LD_LIBRARY_PATH
- 然后看了下
/usr/local/gcc-5.3/missing: 81: /usr/local/gcc-5.3/missing: makeinfo: not found checking for expect... no
解決方法來自:https://stackoverflow.com/questions/338317/what-is-makeinfo-and-how-do-i-get-it
之后再次生成makefile
sudo apt-get install texinfo
sudo /usr/local/gcc-5.3/configure --prefix=/usr/local/gcc-5.3/objdir --enable-languages=c,c++ --enable-threads=posix --disable-multilib --disable-nls --disable-bootstrap --with-gmp=/usr/local/gcc-5.3/gmp-4.3.2 --with-mpfr=/usr/local/gcc-5.3/mpfr-2.4.2 --with-mpc=/usr/local/gcc-5.3/mpc-0.8.1
然后就沒了
- 再次運行
-
sudo make
再次出現了這個問題
-
checking for x86_64-unknown-linux-gnu-gcc... /usr/local/gcc-5.3.0/./gcc/xgcc -B/usr/local/gcc-5.3.0/./gcc/ -B/usr/local/gcc-5.3/objdir/x86_64-unknown-linux-gnu/bin/ -B/usr/local/gcc-5.3/objdir/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/gcc-5.3/objdir/x86_64-unknown-linux-gnu/include -isystem /usr/local/gcc-5.3/objdir/x86_64-unknown-linux-gnu/sys-include checking for suffix of object files... configure: error: in `/usr/local/gcc-5.3.0/x86_64-unknown-linux-gnu/libgcc': configure: error: cannot compute suffix of object files: cannot compile See `config.log' for more details. Makefile:12662: recipe for target 'configure-target-libgcc' failed make[1]: *** [configure-target-libgcc] Error 1 make[1]: Leaving directory '/usr/local/gcc-5.3.0' Makefile:875: recipe for target 'all' failed make: *** [all] Error 2
Round 2
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/gcc-5.3/mpc-0.8.1/lib:/usr/local/gcc-5.3/gmp-4.3.2/lib:/usr/local/gcc-5.3/mpfr-2.4.2/lib/
我再次更改了我路徑的說法,一般情況下,找不到東西,都是應為路徑問題。
checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-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... no checking for mawk... mawk 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 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... yes 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 compatible ISL... no *** This configuration is not supported in the following subdirectories: target-libmpx gnattools gotools target-libada target-libgfortran target-libgo target-libffi target-libbacktrace target-zlib target-libjava target-libobjc target-liboffloadmic target-boehm-gc (Any other directories should still work fine.) checking for default BUILD_CONFIG... checking for --enable-vtable-verify... no checking for bison... no checking for byacc... no checking for yacc... no checking for bison... no checking for gm4... no checking for gnum4... no checking for m4... m4 checking for flex... no checking for lex... no checking for flex... no 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... host tool checking where to find the target gfortran... host tool 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
還是出現了那個問題
我決定鴿了。應該是版本問題,以前的版本比較頑固