gcc5编译linux3.12,linux 编译安装gcc5.3

很多讲安装gcc需要GMP、MPFR、MPC这三个库。先安装GMP,其次MPFR,最后才是MPC。

安装GCC 配置安装选项

#cd /usr/local/gcc-5.3.0

#/opt/gcc-5.3.0/configure --prefix=/usr/local/gcc-5.3.0 -enable-threads=posix -disable-checking -disable-multilib -enable-languages=c,c++ --with-gmp=/usr/local/gmp-4.3.2 --with-mpfr=/usr/local/mpfr-2.4.2 --with-mpc=/usr/local/mpc-0.8.1

#make

#make install

建立软链接

[root@rekfan.com/]#sudo ln -s /usr/local/gcc-5.3/bin/gcc gcc

[root@rekfan.com /]#sudo ln -s /usr/local/gcc-5.3/bin/g++ g++

添加环境变量

打开/etc目录下的bashrc文件添加如下代码:

LD_LIBRARY_PATH=:/usr/local/mpc-0.8.1/lib:/usr/local/gmp-4.3.2/lib:/usr/local/mpfr-2.4.2/lib:/usr/local/gcc-5.3/lib

export LD_LIBRARY_PATH

但实际这种在gcc configure 的时候指定GMP、MPFR、MPC路径的方法有的时候是不可行的。

参考下面gcc安装参考说明,将GMP、MPFR、MPC源码直接放在gcc目录下,再make && make install

GNU Multiple Precision Library (GMP) version 4.3.2 (or later)

Necessary to build GCC.  If a GMP source distribution is found in asubdirectory of your GCC sources named gmp, it will be builttogether with GCC.  Alternatively, if GMP is already installed but itis not in your library search path, you will have to configure with the--with-gmpconfigure option.  See also--with-gmp-liband--with-gmp-include.The in-tree build is only supported with the GMP version thatdownload_prerequisites installs.

MPFR Library version 2.4.2 (or later)

Necessary to build GCC.  It can be downloaded fromhttps://www.mpfr.org.  If an MPFR source distribution is foundin a subdirectory of your GCC sources named mpfr, it will bebuilt together with GCC.  Alternatively, if MPFR is already installedbut it is not in your default library search path, the--with-mpfrconfigure option should be used.  See also--with-mpfr-liband--with-mpfr-include.The in-tree build is only supported with the MPFR version thatdownload_prerequisites installs.

MPC Library version 0.8.1 (or later)

Necessary to build GCC.  It can be downloaded fromhttp://www.multiprecision.org/mpc/.  If an MPC source distributionis found in a subdirectory of your GCC sources named mpc, itwill be built together with GCC.  Alternatively, if MPC is alreadyinstalled but it is not in your default library search path, the--with-mpcconfigure option should be used.  See also--with-mpc-liband--with-mpc-include.The in-tree build is only supported with the MPC version thatdownload_prerequisites installs.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值