zoukankan      html  css  js  c++  java
  • 安装gcc及其依赖

    在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

  • 相关阅读:
    JAVA-初步认识-第十一章-异常-原理异常对象的抛出throw
    shopex后台上传模板漏洞
    PHP使用1个crontab管理多个crontab任务
    HTML5跨浏览器表单及HTML5表单的渐进增强
    用Opera Mobile调试手机版网页【转】
    mootools里选择器$,$$,$E,$ES等的区别
    Call to undefined function bcscale()
    阿里云服务器数据库配置
    阿里云Mysql重置密码
    window.open窗口关闭后刷新父窗口代码
  • 原文地址:https://www.cnblogs.com/aquester/p/9891562.html
Copyright © 2011-2022 走看看