gcc编译安装

Eave 2023.08.06 02:36

1、下载gcc

下载地址:https://gcc.gnu.org

wget "http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-5.4.0/gcc-5.4.0.tar.gz"

2、安装gcc

tar -zxf gcc-5.4.0.tar.gz
cd gcc-5.4.0
# 下载依赖包
./contrib/download_prerequisites
./configure --prefix=/usr --enable-checking=release --enable-languages=c,c++ --disable-multilib
make -j4 && make install

3、配置gcc

# rm /usr/bin/gcc
# ln -s /usr/local/bin/gcc /usr/bin/gcc
cp /usr/local/src/gcc-5.4.0/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.21 /usr/lib64
cd /usr/lib64
rm libstdc++.so.6
ln -s libstdc++.so.6.0.21 libstdc++.so.6

7、查看gcc版本号

gcc -v