在gcc-4.8.2和gcc-4.1.2基础上编译gcc-5.2.0,有可能会遇到一些问题。

要想成功编译gcc,则在编译之前需要安装好它的至少以下三个依赖:
gmp
mpfr
mpc

而mpc又依赖gmp和mpfr。

1) 安装gmp
./configure --prefix=/usr/local/gmp-6.0.0
make
make install

2) 安装mpfr
./configure --prefix=/usr/local/mpfr-3.1.3
make
make install

3) 安装mpc
./configure --prefix=/usr/local/mpc-1.0.3 --with-gmp=/usr/local/gmp-6.0.0 --with-mpfr=/usr/local/mpfr-3.1.3
make
make install

为了成功的编译gcc,建议设置环境变量:
export LD_LIBRARY_PATH=/usr/local/mpc-1.0.3/lib:/usr/local/gmp-6.0.0/lib:/usr/local/mpfr-3.1.3/lib:$LD_LIBRARY_PATH

4) 安装gcc-5.2.0
./configure --prefix=/data/gcc-5.2.0 --with-mpfr=/usr/local/mpfr-3.1.3 --with-gmp=/usr/local/gmp-6.0.0 --with-mpc=/usr/local/mpc-1.0.3
make
make install

4) 安装gcc-4.8.2
./configure --prefix=/data/gcc-4.8.2 --with-mpfr=/usr/local/mpfr-3.1.3 --with-gmp=/usr/local/gmp-6.0.0 --with-mpc=/usr/local/mpc-1.0.3
make
make install

常见错误:
错误1)
configure: error: C compiler cannot create executables
请尝试设置下LD_LIBRARY_PATH后,再执行configure,再make:
export LD_LIBRARY_PATH=/usr/local/mpc-1.0.3/lib:/usr/local/gmp-6.0.0/lib:/usr/local/mpfr-3.1.3/lib:$LD_LIBRARY_PATH

错误2)
../.././libgcc/config/t-softfp:106: 在“else”指令之后含有不该出现的文字
../.././libgcc/config/t-softfp:113: *** 每个条件只能有一个“else”。 停止。

首先通过find命令找到t-softfp(注意是config目录下的t-softfp):
find . -name "t-softfp"

然后进入t-softfp的第106行:
vi ./libgcc/config/t-softfp

98 ifeq ($(enable_shared),yes)
 99     $(call softfp_set_symver,__$(*F))
100     if grep strong_alias $(srcdir)/soft-fp/$@ > /dev/null; then \
101       alias=`grep strong_alias $(srcdir)/soft-fp/$@ | sed -e 's/.*, *//' -e 's/).*//'`; \
102       $(call softfp_set_symver,$$alias); \
103     fi
104 endif
105     echo '#endif' >> $@
106 else ifneq ($(softfp_wrap_start),)
107 softfp_file_list := $(addsuffix .c,$(softfp_func_list))
108 
109 $(softfp_file_list):
110     echo $(softfp_wrap_start) > $@
111     echo '#include "soft-fp/$@"' >> $@
112     echo $(softfp_wrap_end) >> $@
113 else
114 softfp_file_list := \
115   $(addsuffix .c,$(addprefix $(srcdir)/soft-fp/,$(softfp_func_list)))
116 endif

将文件t-softfp的第106行变成两行:
else
    ifneq ($(softfp_wrap_start),)

错误3)
../.././libgcc/config/t-softfp:144: *** 遗漏“endif”。 停止。

第144行已是文件t-softfp的最后一行:
139 LIB2FUNCS_EXCLUDE += \
140   $(addprefix _,$(foreach m,$(softfp_float_modes), \
141                             $(foreach i,si di, \
142                                         $(softfp_floatint_funcs))))
143 endif

按照出错提示增加第144行:
143 endif
144 endif

错误4)使用gcc-4.1.2编译gcc-5.2.0时,遇到如下错误:
checking for suffix of object files... configure: error: in `/data/gcc-5.2.0/x86_64-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
依据错误提示,在config.log中找到如下一些信息:
“when loading shared libraries:libmpc.so.3:cannot open shared object file: No such file or directory”.
解决办法:
export LD_LIBRARY_PATH=/usr/local/mpc/lib:/usr/local/gmp/lib:/usr/local/mpfr/lib:$LD_LIBRARY_PATH

安装gcc及其依赖的更多相关文章

  1. rpm方式安装gcc缺少依赖项的解决方法

    使用rpm方式安装gcc时,有时会报缺少依赖项: libmpfr.so.1 is needed by cpp-4.4.4-13.el6.i686 libppl.so.7 is needed by cl ...

  2. CentOS离线安装GCC编译环境

    gcc编译环境rpm下载 安装相关的rpm包,具体版本可能随时间变化而变化,可以去以下地址下载: 重庆大学镜像:http://b.mirrors.lanunion.org/CentOS/中国科学技术大 ...

  3. CentOS 安装 gcc

    centos linux默认可以采用yum方式安装,则采用如下命令安装gcc编译器即可:#yum -y install gcc 系统会自动安装gcc及依赖组件 gcc                 ...

  4. Linux 安装GCC讲解(在线和无网离线)

    本文主要介绍如何在无网络的环境下怎么离线安装GCC,如果有网,只需要通过命令 yum install gcc 进行安装就可以了,yum会自动把所有关联的依赖包也一起安装了,一键安装. yum inst ...

  5. 转:在CentOS下编译安装GCC

    转:https://teddysun.com/432.html 在CentOS下编译安装GCC 技术  秋水逸冰  发布于: 2015-09-02  更新于: 2015-09-02  6519 次围观 ...

  6. ubuntu安装gcc不同的版本

    服务器ubuntu14.04安装ns3.29中,显示gcc版本过低 使用apt-get安装失败,ubuntu14.04默认安装gcc4.8.4,无法下载更高级的gcc版本 先找到资料1,脚本尝试了,下 ...

  7. RedHat安装GCC问题-解决依赖问题

    RedHat Linux在安装gcc时需要cpp和cloog-ppl但是在安装cpp的时候需要这个依赖:libmpfr.so.1()(64bit) is needed by cpp-4.4.6-3.e ...

  8. redhad安装gcc问题---解决依赖问题

    在安装gcc时需要cpp和cloog-ppl 但是在安装cpp的时候需要这个依赖:  libmpfr.so.1()(64bit) is needed by cpp-4.4.6-3.el6.x86_64 ...

  9. Linux安装gcc时碰到的有关问题解决(解决gcc依赖有关问题)

    Linux安装gcc时碰到的有关问题解决(解决gcc依赖有关问题) rpm安装gcc时碰到的有关问题解决(解决gcc依赖有关问题) 提示:error: Failed dependencies: clo ...

随机推荐

  1. 【转】linux sed命令详解

    原文网址:http://www.iteye.com/topic/587673 1. Sed简介sed 是一种在线编辑器,它一次处理一行内容.处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”( ...

  2. ZedGraph右键菜单怎样禁止它弹出(转)

    private void ZGC_ContextMenuBuilder( ZedGraphControl sender,                     ContextMenuStrip me ...

  3. eclipse启动报错:An error has occurred.See the log file D:\eclipse\configuration\1552616709202.log

    如题,Eclipse崩了,只能按它留下的线索去看了1552616709202.log: !SESSION -- ::08.739 ----------------------------------- ...

  4. VirtualBox的端口映射其实很好理解

    还是和以前百度的另一个知识点一样,我真不明白网上那些人要做什么,明明很简单的事,干嘛非要讲的那么复杂,就是为了让人觉得你很高手?很厉害? 名称:随便起的,基于好记的原则,你的什么应用在使用这一条端口转 ...

  5. .NET实现WebSocket服务端即时通信实例

    即时通信常用手段 1.第三方平台 谷歌.腾讯 环信等多如牛毛,其中谷歌即时通信是免费的,但免费就是免费的并不好用.其他的一些第三方一般收费的,使用要则限流(1s/限制x条消息)要么则限制用户数. 但稳 ...

  6. 谜一样的jquery之$选择器

    jquery是一个强大的js类库,提供了很多便利的操作方法并兼容不同的浏览器,一旦使用便欲罢不能,根本停不下来,今天我们就来解读一下这个神秘的jquery源代码. 前几天思考再三,自己尝试着封装了一下 ...

  7. Hibernate中get()和load()的区别

    Hibernate中根据Id单条查询获取对象的方式有两种,分别是get()和load(),来看一下这两种方式的区别. 1. get() 使用get()来根据ID进行单条查询: User user=se ...

  8. solr删除全部索引数据

    SOLR 删除全部索引数据: <delete><query>*:*</query></delete><commit/>

  9. 使用pandas时遇到ValueError: numpy.dtype has the wrong size, try recompiling

    [问题]使用pandas时遇到ValueError: numpy.dtype has the wrong size, try recompiling [原因] 这是因为 Python 包的版本问题,例 ...

  10. call apply 使用

    1.call 跟 apply的主要区别: call传入参数是一个一个传入,而 apply 使用的是数组传入 call(obj,arg1,arg2,arg3,arg4) apply(obj,[arg1, ...