下载相关源码
wget http://mirrors.aliyun.com/gnu/gmp/gmp-5.0.1.tar.gz
wget http://mirrors.aliyun.com/gnu/mpfr/mpfr-3.1.5.tar.gz
wget http://mirrors.aliyun.com/gnu/mpc/mpc-1.0.1.tar.gz
wget http://mirrors.aliyun.com/gnu/gcc/gcc-10.1.0/gcc-10.1.0.tar.gz
解压并编译
解压步骤略
./configure --prefix=/usr/local/gmp-5.0.1
make
make install
./configure --prefix=/usr/local/mpfr-3.1.5 --with-gmp=/usr/local/gmp-5.0.1
make
make install
./configure --prefix=/usr/local/mpc-1.0.1 --with-gmp=/usr/local/gmp-5.0.1 --with-mpfr=/usr/local/mpfr-3.1.5
make
make install
./configure --prefix=/usr/local/gcc-10.1.0/ --enable-checking=release --enable-languages=c,c++ --disable-multilib --with-gmp=/usr/local/gmp-5.0.1 --with-mpfr=/usr/local/mpfr-3.1.5 --with-mpc=/usr/local/mpc-1.0.1
设置链接路径
echo $LD_LIBRARY_PATH
export LD_LIBRARY_PATH="/usr/local/gmp-5.0.1/lib/":$LD_LIBRARY_PATH
export LD_LIBRARY_PATH="/usr/local/mpfr-3.1.5/lib/":$LD_LIBRARY_PATH
export LD_LIBRARY_PATH="/usr/local/mpc-1.0.1/lib/":$LD_LIBRARY_PATH
echo $LD_LIBRARY_PATH
报错解决
yum install gcc-c++
最后还是报错,感觉是docker 本身的问题(segment fault, 改成make 不带j参数依然报错,查看docker 共享内存是足够的)
最后决定直接用sudo docker pull gcc:10.1.0 单独拉个镜像解决