GCC10.1.0最新版编译

官网地址:GCC, the GNU Compiler Collection- GNU Project

下载编译

wget http://mirror.linux-ia64.org/gnu/gcc/releases/gcc-10.1.0/gcc-10.1.0.tar.gz

tar zxvf gcc-10.1.0.tar.gz

cd gcc-10.1.0/

mkdir build

cd build/

../configure

报错,提示信息configure: error: Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+.

Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify

their locations. Source code for these libraries can be found at

their respective hosting sites as well as at

https://gcc.gnu.org/pub/gcc/infrastructure/. See also

http://gcc.gnu.org/install/prerequisites.html for additional info. If

you obtained GMP, MPFR and/or MPC from a vendor distribution package,

make sure that you have installed both the libraries and the header

files. They may be located in separate packages.

vi ../contrib/download_prerequisites

修改镜像服务器地址

base_url='http://mirror.linux-ia64.org/gnu/gcc/infrastructure/'

接下来下载需要的文件

cd ../

bash contrib/download_prerequisites

可能运行较慢,看不到就着急啊……来,手动下载吧(文件名在contrib/download_prerequisites 里面有)

wget http://mirror.linux-ia64.org/gnu/gcc/infrastructure/gmp-6.1.0.tar.bz2

wget http://mirror.linux-ia64.org/gnu/gcc/infrastructure/mpfr-3.1.4.tar.bz2

wget http://mirror.linux-ia64.org/gnu/gcc/infrastructure/mpc-1.0.3.tar.gz

#wget http://mirror.linux-ia64.org/gnu/gcc/infrastructure/isl-0.18.tar.bz2

tar jxvf gmp-6.1.0.tar.bz2

tar jxvf mpfr-3.1.4.tar.bz2

tar zxvf mpc-1.0.3.tar.gz

#tar jxvf isl-0.18.tar.bz2

ln -s gmp-6.1.0 gmp

ln -s mpfr-3.1.4 mpfr

ln -s mpc-1.0.3 mpc

再次

cd build/

../configure

如果报错configure: error: I suspect your system does not have 32-bit

development libraries (libc and headers). If you have them,

rerun configure with --enable-multilib. If you do not have them,

and want to build a 64-bit-only compiler, rerun configure with

--disable-multilib.

也就是说,configure推断本机没有32位开发库,如果的确有就加上--enable-multilib选项,否则就使用--disable-multilib选项只构建64位版本。

就改为

../configure --disable-multilib

生成Makefile后执行(-j 8代表8个线程)

make -j 8

……需要等待好久,吃个饭去吧

安装

sudo make install

安装完成后看下版本

gcc --version

g++ --version

都是10.1.0了

使用问题

/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by ./bin/navicat-patcher)

解决

#首先找下新编译的这个文件在哪里

find /usr/local -name "libstdc++.so.6"

#输出/usr/local/lib64/libstdc++.so.6

#旧版文件备份

sudo mv /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.bak

#创建软连接过去

sudo ln -s /usr/local/lib64/libstdc++.so.6 /usr/lib/x86_64-linux-gnu/libstdc++.so.6

#确认下GLIBCXX_3.4.26在不在输出清单里

strings /usr/local/lib64/libstdc++.so.6 | grep GLIBC

  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

草宝虫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值