yum -y groupinstall "development tools"
yum -y install dejagnu texinfo
2、安装
cd /home/share
tar -zxf gcc-9.3.0.tar.gz
rm -f gcc-9.3.0.tar.gz
cd gcc-9.3.0
./contrib/download_prerequisites
mkdir build
cd build
../configure --prefix=/home/software/gcc-9.3.0 --enable-bootstrap --enable-checking=release --enable-languages=c,c++ --disable-multilib
make -j2 && make install
3、移除安装包
cd /home/share
rm -rf gcc-9.3.0
4、更新lib库软链接
cd /lib64/
rm -f libstdc++.so.6
ln -s /home/software/gcc-9.3.0/lib64/libstdc++.so.6.0.28 libstdc++.so.6
配置环境变量模块
mkdir -p /home/software/modules/gcc/
vi /home/software/modules/gcc/9.3
点击(此处)折叠或打开
- #%Module1.0
- set GCC /home/software/gcc-9.3.0
- prepend-path PATH ${GCC}/bin
- prepend-path LD_LIBRARY_PATH ${GCC}/lib64
- prepend-path INCLUDE ${GCC}/include