码迷,mamicode.com
首页 > 系统相关 > 详细

在ubuntu14.04环境下编译gcc

时间:2016-02-19 01:41:40      阅读:276      评论:0      收藏:0      [点我收藏+]

标签:version   library   already   search   option   

  1. 到GNU开源网址下载gcc源码,并查看编译教程

    GNU/GCC网址:http://www.gnu.org/software/gcc/

    2.根据官网教程,编译gcc的所需环境依赖m4,gmp,mfpr,mpc

        

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

  • Necessary to build GCC.  If a GMP source distribution is found in a subdirectory of your GCC sources named gmp, it will be built together with GCC.  Alternatively, if GMP is already installed but it is not in your library search path, you will have to configure with the--with-gmp configure option.  See also --with-gmp-liband --with-gmp-include.    

  • MPFR Library version 2.4.2 (or later)

  • Necessary to build GCC.  It can be downloaded fromhttp://www.mpfr.org/.  If an MPFR source distribution is found in a subdirectory of your GCC sources named mpfr, it will be built together with GCC.  Alternatively, if MPFR is already installed but it is not in your default library search path, the--with-mpfr configure option should be used.  See also--with-mpfr-lib and --with-mpfr-include.    

  • MPC Library version 0.8.1 (or later)

  • Necessary to build GCC.  It can be downloaded fromhttp://www.multiprecision.org/.  If an MPC source distribution is found in a subdirectory of your GCC sources named mpc, it will be built together with GCC.  Alternatively, if MPC is already installed but it is not in your default library search path, the--with-mpc configure option should be used.  See also--with-mpc-lib and --with-mpc-include.

                                                                        --------来自https://gcc.gnu.org/install/prerequisites.html

    3.以上一个依赖包,也是GNU项目,可从GNU网站找到

            http://www.gnu.org/software/m4/

            http://www.gnu.org/software/gmp/

            http://www.gnu.org/software/mpfr/

           http://www.gnu.org/software/mpc/

     4.按顺序依次

                解压

                        tar xjf XXX.tar.bz2

                ./configure

                make

                sudo make install

      5.编译gcc

                解压gcc源码

                创建gcc-build

                ../gcc-5.3.0/configure

                设置环境变量     export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

                make

                sudo make install

       6.成功

                /usr/local/bin/gcc -v

         

       7.遇到问题:

                问题1:  cannot compute suffix of object files: cannot compile

                        配置环境变量,或者路径不对

                       解决: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

在ubuntu14.04环境下编译gcc

标签:version   library   already   search   option   

原文地址:http://9552815.blog.51cto.com/9542815/1743183

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!