下载gcc安装包和依赖包
下载地址:https://github.com/gcc-mirror/gcc/archive/refs/tags/releases/gcc-4.8.5.tar.gz
如果需要安装其它版本,可以这里找:https://github.com/gcc-mirror/gcc/tags
cd /usr/local/src/
wget https://github.com/gcc-mirror/gcc/archive/refs/tags/releases/gcc-4.8.5.tar.gz
tar -zxvf gcc-4.8.5.tar.gz
cd gcc-releases-gcc-4.8.5 # 进入解压后的目录
./contrib/download_prerequisites # 下载依赖(如果执行很慢,可其它途径下载)
# 编译安装gcc
./configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
依赖包说明
download_prerequisites 脚本的内容如下
看下面脚本可以看到gcc-4.8.5依赖mpfr-2.4.2、gmp-4.3.2、mpc-0.8.1这3个包
MPFR=mpfr-2.4.2
GMP=gmp-4.3.2
MPC=mpc-0.8.1
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$MPFR.tar.bz2 || exit 1 # 如果包已存在,可以注释掉wget
tar xjf $MPFR.tar.bz2 || exit 1
ln -sf $MPFR mpfr || exit 1
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$GMP.tar.bz2 || exit 1
tar xjf $GMP.tar.bz2 || exit 1
ln -sf $GMP gmp || exit 1
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$MPC.tar.gz || exit 1
tar xzf $MPC.tar.gz || exit 1
ln -sf $MPC mpc || exit 1
rm $MPFR.tar.bz2 $GMP.tar.bz2 $MPC.tar.gz || exit 1
标签:gcc,bz2,tar,gz,exit,版本,GMP,安装,gcc4.8
From: https://www.cnblogs.com/JaminXie/p/16704848.html