首先下载gcc 8.4.0源码:
https://mirrors.sjtug.sjtu.edu.cn/gnu/gcc/gcc-8.4.0/gcc-8.4.0.tar.gz
解压并编译
- tar xzvf gcc-8.4.0.tar.gz
- cd gcc-8.4.0
- contrib/download_prerequisites /* 下载 gmp、mpfr、mpc和isl */
- ./configure --prefix=/root/soft /* 这里可能需要指定gmp、mpfr、mpc和isl,需要编译 */
- make
- make install
错误处理
- /usr/bin/ld: cannot find Scrt1.o: No such file or directory
sudo apt install gcc-multilib
参考:https://blog.csdn.net/kekoxl/article/details/117324421