CentOS GCC 8. 3.0 编译安装
下载
1 | wget http://ftp.gnu.org/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.xz |
解压
1 | tar xJvf gcc-8.3.0.tar.xz |
编译安装
1 | cd gcc-8.3.0.tar.xz |
2 | ./contrib/download_prerequisites #下载依赖包 |
3 | mkdir build |
4 | mkdir $HOME/gcc-8.3 |
5 | cd build |
6 | ../configure --prefix=$HOME/gcc-8.3 --enable-checking=release --enable-languages=c,c++ --disable-multilib |
7 | make -j 4 |
8 | make -j 4 install |
设置环境变量
1 | echo '###gcc-8.3.0' >> ~/.bashrc |
2 | echo 'export PATH=$HOME/gcc-8.3/bin:$PATH' >> ~/.bashrc #$HOME根据实际情况修改 |
3 | echo 'export LD_LIBRARY_PATH=$HOME/gcc-8.3/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc #$HOME根据实际情况修改 |
4 | source ~/.bashrc |
查看版本信息
1 | gcc --version |