本家 http://gcc.gnu.org/

2013.06.07 gcc-4.8.1

gccのjavacとなるgcj(gnu compiler for java)がどうしても作れなかった。
まぁー普段使うであろう gcc,g++,fortran が使えればいいので、それを焦点として作りました

事前インストールもの

  1
  2
  3
[root@c131 ~]# yum -y groupinstall "Development tools"
[root@c131 ~]# yum -y install dejagnu                          *make checkの際必要
[root@c131 ~]# yum -y install guile-devel zlib-devel           *autogenに

標準の環境からコンパイルするなら

  1
  2
  3
[root@c131 ~]# export PATH=/sbin:/bin:/usr/sbin:/usr/bin
[root@c131 ~]# export LANG=C
[root@c131 ~]# unset LD_LIBRARY_PATH

としたほうがいいのかも

1. GNU Multiple Precision Library(GMP)

本家 http://gmplib.org/

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
[root@c131 ~]# wget ftp://ftp.gmplib.org/pub/gmp-5.1.2/gmp-5.1.2.tar.bz2
[root@c131 ~]# bzip2 -cd gmp-5.1.2.tar.bz2 | tar xf -
[root@c131 ~]# cd gmp-5.1.2
[root@c131 gmp-5.1.2]# CPPFLAGS=-fexceptions ./configure --enable-cxx --prefix=/usr/local --libdir=/usr/local/lib64
 (中略)
  Version:           GNU MP 5.1.2
  Host type:         coreisbr-unknown-linux-gnu
  ABI:               64
  Install prefix:    /usr/local
  Compiler:          gcc -std=gnu99
  Static libraries:  yes
  Shared libraries:  yes
[root@c131 gmp-5.1.2]# make; make check; make install
[root@c131 gmp-5.1.2]# echo "/usr/local/lib64" > /etc/ld.so.conf.d/local64.conf
[root@c131 gmp-5.1.2]# ldconfig -v
/usr/local/lib64:
        libgmpxx.so.4 -> libgmpxx.so.4.3.2
        libgmp.so.10 -> libgmp.so.10.1.2
(略)
[root@c131 gmp-5.1.2]# cd ../

2. MPFR Library(MPFR: the Multiple Precision Floating-Point Reliable Library)

本家 http://www.mpfr.org/

  1
  2
  3
  4
  5
  6
  7
[root@c131 ~]# wget http://www.mpfr.org/mpfr-current/mpfr-3.1.2.tar.xz    *released on 13 March 2013
[root@c131 ~]# xz -cd mpfr-3.1.2.tar.xz | tar xf -
[root@c131 ~]# cd mpfr-3.1.2
[root@c131 mpfr-3.1.2]# ./configure --with-gmp-include=/usr/local/include --with-gmp-lib=/usr/local/lib64 \
> --prefix=/usr/local --libdir=/usr/local/lib64
[root@c131 mpfr-3.1.2]# make; make check; make install; ldconfig
[root@c131 mpfr-3.1.2]# cd ../

3. MPC Library( multiple-precision complex number computations)

本家 http://www.multiprecision.org/

  1
  2
  3
  4
  5
  6
  7
[root@c131 ~]# wget http://www.multiprecision.org/mpc/download/mpc-1.0.1.tar.gz
[root@c131 ~]# gzip -cd mpc-1.0.1.tar.gz| tar xf -
[root@c131 ~]# cd mpc-1.0.1
[root@c131 mpc-1.0.1]# ./configure --with-gmp-lib=/usr/local/lib64 --with-mpfr-lib=/usr/local/lib64 \
> --prefix=/usr/local --libdir=/usr/local/lib64
[root@c131 mpc-1.0.1]# make; make check;make install; ldconfig
[root@c131 mpc-1.0.1]# cd ../

4. ISL Library

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
[root@c131 ~]# wget ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.11.1.tar.bz2
[root@c131 ~]# bzip2 -cd isl-0.11.1.tar.bz2 | tar xf -
[root@c131 ~]# cd isl-0.11.1
[root@c131 isl-0.11.1]# vi configure
17034行目で
       - GMP_LDFLAGS="-L$with_gmp_prefix/lib"
       + GMP_LDFLAGS="-L$with_gmp_prefix/lib64"
と17870行目で
       - GIT_HEAD_ID="UNKOWN"
       + GIT_HEAD_ID="isl-0.11.1"
を施して
[root@c131 isl-0.11.1]# ./configure --with-gmp=build --with-gmp-prefix=/usr/local --with-gmp=yes \
  --prefix=/usr/local --libdir=/usr/local/lib64 
[root@c131 isl-0.11.1]# make; make check; make install; ldconfig
*/usr/local/lib64/libisl.so.10.1.1-gdb.pyは削除
[root@c131 isl-0.11.1]# cd ../

5. CLooG

本家 http://www.cloog.org/
ClooGの中にislがあるのだが、それは使わない方向で。

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
[root@c131 ~]# wget ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-0.18.0.tar.gz
[root@c131 ~]# gzip -cd cloog-0.18.0.tar.gz | tar xf -
[root@c131 ~]# cd cloog-0.18.0
[root@c131 cloog-0.18.0]# vi configure
12962行目
         - LDFLAGS="-L$with_gmp_exec_prefix/lib $LDFLAGS"
         + LDFLAGS="-L$with_gmp_exec_prefix/lib64 $LDFLAGS"
として
[root@c131 cloog-0.18.0]# ./configure --with-gmp-prefix==/usr/local  \
--prefix=/usr/local --libdir=/usr/local/lib64 --with-isl=system --with-gmp=system
[root@c131 cloog-0.18.0]# make; make check; make install; ldconfig
[root@c131 cloog-0.18.0]# cd ../

ちょいと確認

  1
  2
  3
  4
  5
  6
  7
  8
[root@c131 ~]# ldd /usr/local/bin/cloog
        linux-vdso.so.1 =>  (0x00007fff173fe000)
        libcloog-isl.so.4 => /usr/local/lib64/libcloog-isl.so.4 (0x00007f1186c45000)
        libgmp.so.10 => /usr/local/lib64/libgmp.so.10 (0x00007f11869d0000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f118663d000)
        libisl.so.10 => /usr/local/lib64/libisl.so.10 (0x00007f1186311000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f1186e75000)
[root@c131 ~]#

gmpは導入した/usr/local/lib64/libgmp.so.10が使われ、
islも導入した/usr/local/lib64/libisl.so.10が使われている。

6. autogen [gccのmake checkに使うみたい]

本家 http://www.gnu.org/software/autogen/

  1
  2
  3
  4
  5
  6
[root@c131 ~]# wget http://ftp.gnu.org/gnu/autogen/rel5.17.4/autogen-5.17.4.tar.xz
[root@c131 ~]# xz -cd autogen-5.17.4.tar.xz | tar xf -
[root@c131 ~]# cd autogen-5.17.4
[root@c131 autogen-5.17.4]# ./configure --prefix=/usr/local --libdir=/usr/local/lib64
[root@c131 autogen-5.17.4]# make; make check; make install; ldconfig
[root@c131 autogen-5.17.4]# cd ../

本体GCCのコンパイル

64bitのみの対応品として、c,c++,fortranを作り、場所は/usr/local/gcc482とする

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
[root@c131 ~]# wget http://ftp.riken.jp/GNU/gnu/gcc/gcc-4.8.1/gcc-4.8.1.tar.bz2
[root@c131 ~]# bzip2 -cd gcc-4.8.1.tar.bz2 | tar xf -
[root@c131 ~]# mkdir build-gcc482
[root@c131 ~]# cd build-gcc482
[root@c131 build-gcc482]# ../gcc-4.8.1/configure \
--enable-languages=c,c++,fortran \
--enable-bootstrap \
--enable-shared \
--enable-threads=posix \
--enable-checking=release \
--with-system-zlib \
--enable-__cxa_atexit \
--enable-gnu-unique-object \
--with-gmp=/usr/local --with-gmp-include=/usr/local/include --with-gmp-lib=/usr/local/lib64 \
--with-mpfr=/usr/local --with-mpfr-include=/usr/local/include --with-mpfr-lib=/usr/local/lib64 \
--with-mpc=/usr/local --with-mpc-include=/usr/local/include --with-mpc-lib=/usr/local/lib64 \
--with-isl=/usr/local --with-isl-include=/usr/local/include --with-isl-lib=/usr/local/lib64 \
--with-cloog=/usr/local --with-cloog-include=/usr/local/include --with-cloog-lib=/usr/local/lib64 \
--prefix=/usr/local/gcc482 \
--libdir=/usr/local/gcc482/lib64 \
--with-local-prefix=/usr/local/gcc482 \
--with-pkgversion="gcc-4.8.2 20130607 by chaperone" --without-bugurl
[root@c131 build-gcc482]# make -j3 2>&1 | tee make-log                 *紅茶とケーキで気長に待ちましょう
[root@c131 build-gcc482]# make check                                   *追加の紅茶を頂きましょう
[root@c131 build-gcc482]# make install

っでテスト

  1
  2
  3
  4
  5
  6
  7
[root@c131 ~]# /usr/local/gcc482/bin/gcc --version
gcc (gcc-4.8.2 20130607 by chaperone) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
[root@c131 ~]#

作ったコンパイラーを使うには
export PATH=/usr/local/gcc482/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/gcc482/lib:/usr/local/gcc482/lib64
として使います。

gcc-4.7.1

■centos5.x(64bit)でのコンパイル

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
../gcc-4.7.1/configure \
--enable-languages=c,c++,fortran \
--enable-bootstrap \
--enable-shared \
--enable-threads=posix \
--enable-checking=release \
--with-system-zlib \
--enable-__cxa_atexit \
--disable-libunwind-exceptions \
--disable-gnu-unique-object \                    *CentOS6.xではenableだが、CentOS5.xではdisable
--disable-dssi \
--with-tune=generic \
--with-ppl-lib=/usr/local/lib64 --with-cloog-lib=/usr/local/lib64 \
--with-gmp-lib=/usr/local/lib64 --with-mpfr-lib=/usr/local/lib64 \
--with-mpc-lib=/usr/local/lib64 \
--build=x86_64-redhat-linux --disable-multilib --prefix=/usr/local

■centos5.x(32bit)でのコンパイル
../gcc-4.7.1/configure --enable-languages=c,c++,fortran \
--enable-bootstrap --enable-shared --enable-threads=posix \
--enable-checking=release --with-system-zlib --enable-__cxa_atexit \
--disable-libunwind-exceptions \
--disable-gnu-unique-object \
--disable-dssi \
--with-tune=generic \
--with-ppl-lib=/usr/local/lib --with-cloog-lib=/usr/local/lib \
--with-gmp-lib=/usr/local/lib --with-mpfr-lib=/usr/local/lib \
--with-mpc-lib=/usr/local/lib \
--build=i686-redhat-linux --disable-multilib --prefix=/usr/local

*CentOS5.xのglibcは 2.5 である(yum info glibcより)。[enable-gnu-unique-object]は 2.11以上から使える

最新の60件
2026-01-18 2026-01-17 2026-01-16 2026-01-12 2026-01-11 2026-01-10 2026-01-09 2026-01-08 2026-01-06 2026-01-04 2026-01-01 2025-12-31 2025-12-28 2025-12-27 2025-12-12 2025-12-11 2025-12-09 2025-12-08 2025-12-07 2025-12-05 2025-11-30 2025-11-27 2025-11-24 2025-11-23 2025-11-18 2025-11-16 2025-11-05 2025-11-03 2025-11-02 2025-10-30 2025-10-29 2025-10-28 2025-10-26 2025-10-25 2025-10-24 2025-10-22 2025-10-21 2025-10-17 2025-10-13 2025-10-11 2025-10-06 2025-10-05

edit


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2013-06-08 (土) 21:52:19