CentOS编译安装GCC 10.2
Linux系统会预装GCC,但是出于稳定性和兼容性的考虑,预装的GCC版本都是较低的稳定版,而有些软件的新版本安装编译时需要较高版本的GCC,对于普通用户来说,就需要在自己的目录下安装所需版本的GCC了。此文中的路径需要自行更改。
依赖包安装
gmp编译
此处提供百度网盘下载链接gmp-6.2.0,提取码g5lh
1 | tar -vxf gmp-6.2.0.tar.bz2 |
2 | cd gmp-6.2.0/ |
3 | ./configure --prefix=/home/luyh/software/gmp |
4 | make |
5 | make install |
6 | --- |
7 | echo 'export LD_LIBRARY_PATH=/home/luyh/software/gmp/lib:$LD_LIBRARY_PATH' >> ~/.bashrc |
8 | |
9 | source ~/.bashrc |
mpfr编译
此处提供百度网盘下载链接mpfr-4.1.0,提取码0bh4
1 | tar -vxf mpfr-4.1.0.tar.xz |
2 | cd mpfr-4.1.0 |
3 | ./configure --prefix=/home/luyh/software/mpfr --with-gmp=/home/luyh/software/gmp |
4 | make |
5 | make install |
6 | --- |
7 | echo 'export LD_LIBRARY_PATH=/home/luyh/software/mpfr/lib:$LD_LIBRARY_PATH' >> ~/.bashrc |
8 | |
9 | source ~/.bashrc |
mpc编译
此处提供百度网盘下载链接mpc-1.1.0,提取码9wiy
1 | tar -vxf mpc-1.1.0.tar.gz |
2 | cd mpc-1.1.0 |
3 | ./configure --prefix=/home/luyh/software/mpc --with-gmp=/home/luyh/software/gmp --with-mpfr=/home/luyh/software/mpfr |
4 | make |
5 | make install |
6 | --- |
7 | echo 'export LD_LIBRARY_PATH=/home/luyh/software/mpc/lib:$LD_LIBRARY_PATH' >> ~/.bashrc |
8 | |
9 | source ~/.bashrc |
GCC安装
此处提供百度网盘下载链接gcc-10.2.0,提取码skvd
1 | tar -xvf gcc-10.2.0.tar.xz |
2 | cd gcc-10.2.0 |
3 | mkdir build |
4 | cd build |
5 | unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE |
6 | ../configure --prefix=/home/luyh/software/gcc-10.2.0 --enable-checking=release --enable-stage1-languages=all --disable-multilib --with-gmp-include=/home/luyh/software/gmp/include --with-gmp-lib=/home/luyh/software/gmp/lib --with-mpfr-include=/home/luyh/software/mpfr/include --with-mpfr-lib=/home/luyh/software/mpfr/lib --with-mpc-include=/home/luyh/software/mpc/include --with-mpc-lib=/home/luyh/software/mpc/lib |
7 | make |
8 | make install |
9 | echo '### gcc 10.2' >> ~/.bashrc |
10 | echo 'export PATH=/home/luyh/software/gcc-10.2.0/bin:$PATH' >> ~/.bashrc |
11 | echo 'export LD_LIBRARY_PATH=/home/luyh/software/gcc-10.2.0/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc |
12 | |
13 | source ~/.bashrc |