- GNU Multiple Precision Library (GMP) version 4.3.2 (or later)
- MPFR Library version 2.4.2 (or later)
- MPC Library version 0.8.1 (or later)
然後還要先安裝一些軟體:
- sudo apt-get install gcc-multilib
- sudo apt-get install autogen
接著依照下面的順序執行:
I. 安裝GMP 6.1.0
- wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2
- md5sum gmp-6.1.0.tar.bz2
86ee6e54ebfc4a90b643a65e402c4048 gmp-6.1.0.tar.bz2 - tar jxf gmp-6.1.0.tar.bz2 && cd gmp-6.1.0
- ./configure --prefix=/opt/gmp-6.1.0
- make -j 12
- make check
- sudo make install
II. 安裝MPFR 3.1.4
- wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2
- md5sum mpfr-3.1.4.tar.bz2
b8a2f6b0e68bef46e53da2ac439e1cf4 mpfr-3.1.4.tar.bz2 - tar jxf mpfr-3.1.4.tar.bz2 && cd mpfr-3.1.4
- ./configure --prefix=/opt/mpfr-3.1.4-gmp610 \
--with-gmp=/opt/gmp-6.1.0 - make -j 12
- make check
- sudo make install
III. 安裝MPC 1.0.3
- wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz
- md5sum mpc-1.0.3.tar.gz
d6a1d5f8ddea3abd2cc3e98f58352d26 mpc-1.0.3.tar.gz - tar zxf mpc-1.0.3.tar.gz && cd mpc-1.0.3
- ./configure --prefix=/opt/mpc-1.0.3-mpfr314-gmp610 \
--with-mpfr=/opt/mpfr-3.1.4-gmp610 \
--with-gmp=/opt/gmp-6.1.0 - make -j 12
- make check
- sudo make install
IV. 安裝isl Library 0.15
- wget ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.15.tar.bz2
- md5sum isl-0.15.tar.bz2
8428efbbc6f6e2810ce5c1ba73ecf98c isl-0.15.tar.bz2 - tar jxf isl-0.15.tar.bz2 && cd isl-0.15
- ./configure --prefix=/opt/isl-0.15-gmx610 \
--with-gmp=/opt/gmp-6.1.0 - make -j 12
- make check
- sudo make install
V. 安裝GCC 5.5.0
- wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-5.5.0/gcc-5.5.0.tar.gz
- shasum -a 512 gcc-5.5.0.tar.gz
ace0dafc56025b1ed22d06f20b3af2e6c4896b91c36289cfb129dcd6531b53f754150cc69a5b9c6f305598e4d643c80b114ed17cdc93ac979661d31073dd4ffd gcc-5.5.0.tar.gz - tar zxf gcc-5.5.0.tar.gz && cd gcc-5.5.0
- ./configure --prefix=/opt/gcc-5.5.0 \
--with-isl=/opt/isl-0.15-gmx610 \
--with-mpc=/opt/mpc-1.0.3-mpfr314-gmp610 \
--with-mpfr=/opt/mpfr-3.1.4-gmp610 \
--with-gmp=/opt/gmp-6.1.0 - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/gmp-6.1.0/lib:/opt/mpfr-3.1.4-gmp610/lib:/opt/mpc-1.0.3-mpfr314-gmp610/lib:/opt/isl-0.15-gmx610/lib
- make -j 12
- make check
- sudo make install
VI. 使用GCC 5.5.0編譯程式
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/gmp-6.1.0/lib:/opt/mpfr-3.1.4-gmp610/lib:/opt/mpc-1.0.3-mpfr314-gmp610/lib:/opt/isl-0.15-gmx610/lib
- /opt/gcc-5.5.0/bin/gcc -o hello hello.c
- ./hello
參考資料
- Gcc compilation “cannot compute suffix of object files: cannot compile”
- 关于gcc-4.7.2 cannot compute suffix of object file...
- GCC 5.5.0编译器构建安装简述
- gcc 4.5.2 在linux上編譯遇到的問題
- CentOS上源码安装GCC 4.8.2
沒有留言:
張貼留言