参考:
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'