centos编译gcc10

在centos下编译gcc10

先安装3个依赖库 

#!/bin/bash
dir=$(pwd)
cd $dir
rm -f gmp-5.0.2.tar.gz
wget http://ftp.gnu.org/gnu/gmp/gmp-5.0.2.tar.gz
tar -xf gmp-5.0.2.tar.gz
cd gmp-5.0.2
./configure --enable-static --disable=shared
make && make install

cd $dir
rm -f mpfr-3.1.1.tar.gz
wget http://ftp.gnu.org/gnu/mpfr/mpfr-3.1.1.tar.gz
tar -xf mpfr-3.1.1.tar.gz
cd mpfr-3.1.1
./configure --enable-static --disable=shared
make && make install

cd $dir
rm -f mpc-1.0.1.tar.gz
wget http://ftp.gnu.org/gnu/mpc/mpc-1.0.1.tar.gz
tar -xf mpc-1.0.1.tar.gz
cd mpc-1.0.1
./configure --enable-static --disable=shared
make && make install

然后就可以编译gcc了

tar -xf gcc-10.1.0.tar.gz
cd gcc-10.1.0
./configure --prefix=/root/gcc/bin --enable-checking=release --enable-languages=c,c++ --disable-multilib
make -j4
make install
原文地址:https://www.cnblogs.com/yuandaozhe/p/14333753.html