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

相關文章
相關標籤/搜索