ubuntu下如何编译GCC4.8

1.获取源码: html

svn checkout svn://gcc.gnu.org/svn/gcc/trunk SomeLocalDir node

2.安装GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+: shell

下载地址: ftp://gcc.gnu.org/pub/gcc/infrastructure/  ubuntu

  • 安装GMP:
         编译方法:./configure 

                       make svn

                       make check ui

                       sudo make install spa

    安装MPFR: code

       编译方法: ./configure  htm

                        make ci

                        make check

                       sudo make install

    安装MPC:

      编译方法: ./configure 

                        make

                        make check

                       sudo make install

3. ./configure 

若是出现一下错误,说明你没有安装好上面3个库。

configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.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
ftp://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.
4.make 

编译须要很长时间。。。

过程若是出现如下相似错误:

c-ada-spec.c:(.text+0x8d6d): undefined reference to `tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*)'
c-ada-spec.c:(.text+0x8d95): undefined reference to `tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*)'
c-ada-spec.c:(.text+0x8dbd): undefined reference to `tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*)'
c-ada-spec.c:(.text+0x8de5): undefined reference to `tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*)'
c-ada-spec.c:(.text+0x8e0d): undefined reference to `tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*)'
说明你没有安装clang编译器,编译gcc4.8要求clang3.0以上,经过sudo apt-get 获取的是的2.8的版本。

因此到官网下载去:http://llvm.org/releases/download.html#3.2

直接下载二进制文件,懒得本身编译了,我下载的是ubuntu12.04版本。下载后直接安装。

5.sudo make instal

相关文章
相关标签/搜索