gcc-4.6.0をインストール ダウンロードディレクトリ:/usr/local/src インストールディレクトリ:/usr/local/gcc-4.6.0 (あらかじめ作成) 参考リンク:http://gcc.gnu.org/ ダウンロード # wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.6.0/gcc-4.6.0.tar.gz # tar zxvf gcc-4.6.0.tar.gz # cd gcc-4.6.0 インストール # ./configure --prefix=/usr/local/gcc-4.6.0 checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c checking whether ln works... yes checking whether ln -s works... yes checking for a sed that does not truncate output... /bin/sed checking for gawk... gawk checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking for gnatbind... no checking for gnatmake... no checking whether compiler driver understands Ada... no checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2 checking for objdir... .libs checking for the correct version of gmp.h... no configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ 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. いきなりエラー・・・いい加減にしろ。 (また、このパターン・・・面倒だ) ----[ここから間違いなので実行しない]---- ・・・gccのコンパイルバージョンが足りないって言ってんのかこれ??? 以下でバージョン確認 # gcc -v Using built-in specs. Target: i386-redhat-linux コンフィグオプション: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --disable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux スレッドモデル: posix gcc バージョン 4.1.2 20080704 (Red Hat 4.1.2-50) エラー内容・・・ configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+. を見るに4.2以上が必要ってことか・・・ じゃあいいや・・・gcc-4.2.0インストールしてからまたインストールするか・・・はぁ ダウンロードディレクトリ:/usr/local/src インストールディレクトリ:/usr/local/gcc-4.2.0 (あらかじめ作成) # wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.2.0/gcc-4.2.0.tar.bz2 つか・・・tar.bz2かよ・・・ ネットで解凍コマンドを検索・・・検索・・・ (最近、テンションがおかしい・・・) 以下のコマンドで一発解凍 # tar jxvf gcc-4.2.0.tar.bz2 # cd gcc-4.2.0 じゃ、インストールに移る まずは、configure # ./configure --prefix=/usr/local/gcc-4.2.0 問題なく通ったようなので、 レイジング・ハート セーートアップ!!(いいえ、ただのgccです・・・) # make なにか・・・変な文章が見える気がするけど、気にしない気にしない〜 それにしても・・・なげぇ〜、makeなげぇ〜よ・・・ # make install gccで何かコンパイルする際に、デフォルトでないgccを指定するのってどうやるんだ??? またまた検索検索zzz ----[ここまで間違いなので実行しない]---- エラー内容・・・ configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+. について内容を勘違いしていた・・・ 以下のサイトにあるように・・・ほんとそのままだった・・・ 参考リンク:http://blog.soi33.org/archives/248 4.2インストールした意味ねぇー・・・orz 仕切り直して、gmp、mpfr、mpcをインストールする。 順番:gmp → mpfr → mpc (依存関係があるため) (いきなり、英語ペラペラにならねぇかな・・・) gmpインストール ダウンロードサイト:http://gmplib.org/ ダウンロードディレクトリ:/usr/local/src インストールディレクトリ:/usr/local/gmp-5.0.2 (あらかじめ作成) # wget ftp://ftp.gmplib.org/pub/gmp-5.0.2/gmp-5.0.2.tar.gz # tar zxvf gmp-5.0.2.tar.gz # cd gmp-5.0.2 # ./configure --prefix=/usr/local/gmp-5.0.2 # make 終了間際にこんなん出てきた・・・ +-------------------------------------------------------------+ | CAUTION: | | | | If you have not already run "make check", then we strongly | | recommend you do so. | | | | GMP has been carefully tested by its authors, but compilers | | are all too often released with serious bugs. GMP tends to | | explore interesting corners in compilers and has hit bugs | | on quite a few occasions. | | | +-------------------------------------------------------------+ だが、断る!! # make install mpfrインストール ダウンロードサイト:http://www.mpfr.org/mpfr-current/#download ダウンロードディレクトリ:/usr/local/src インストールディレクトリ:/usr/local/mpfr-3.0.1 (あらかじめ作成) # wget http://www.mpfr.org/mpfr-current/mpfr-3.0.1.tar.gz # tar zxvf mpfr-3.0.1.tar.gz # cd mpfr-3.0.1 # ./configure --prefix=/usr/local/mpfr-3.0.1 --with-gmp=/usr/local/gmp-5.0.2 # make # make install mpcインストール ダウンロードサイト:http://www.multiprecision.org/index.php?prog=mpc&page=download ダウンロードディレクトリ:/usr/local/src インストールディレクトリ:/usr/local/mpc-0.9 (あらかじめ作成) # wget http://www.multiprecision.org/mpc/download/mpc-0.9.tar.gz # tar zxvf mpc-0.9.tar.gz # cd mpc-0.9 # ./configure --prefix=/usr/local/mpc-0.9 --with-gmp=/usr/local/gmp-5.0.2 --with-mpfr=/usr/local/mpfr-3.0.1 # make # make install よっし足らないパッケージのインストールは終わった・・・ gcc-4.6.0のインストールを再開しようか・・・ # cd gcc-4.6.0 # ./configure --prefix=/usr/local/gcc-4.6.0 --with-gmp=/usr/local/gmp-5.0.2 --with-mpfr=/usr/local/mpfr-3.0.1 --with-mpc=/usr/local/mpc-0.9 通ったど〜・・・(テンション低っく・・・) # make rm gcc.pod make[3]: ディレクトリ `/usr/local/src/gcc-4.6.0/host-i686-pc-linux-gnu/gcc' から出ます mkdir -p -- i686-pc-linux-gnu/libgcc Checking multilib configuration for libgcc... Configuring stage 1 in i686-pc-linux-gnu/libgcc configure: creating cache ./config.cache checking for --enable-version-specific-runtime-libs... no checking for a BSD-compatible install... /usr/bin/install -c checking for gawk... gawk checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking for i686-pc-linux-gnu-ar... ar checking for i686-pc-linux-gnu-lipo... lipo checking for i686-pc-linux-gnu-nm... /usr/local/src/gcc-4.6.0/host-i686-pc-linux-gnu/gcc/nm checking for i686-pc-linux-gnu-ranlib... ranlib checking for i686-pc-linux-gnu-strip... strip checking whether ln -s works... yes checking for i686-pc-linux-gnu-gcc... /usr/local/src/gcc-4.6.0/host-i686-pc-linux-gnu/gcc/xgcc -B/usr/local/src/gcc-4.6.0/host-i686-pc-linux-gnu/gcc/ -B/usr/local/gcc-4.6.0/i686-pc-linux-gnu/bin/ -B/usr/local/gcc-4.6.0/i686-pc-linux-gnu/lib/ -isystem /usr/local/gcc-4.6.0/i686-pc-linux-gnu/include -isystem /usr/local/gcc-4.6.0/i686-pc-linux-gnu/sys-include checking for suffix of object files... configure: error: in `/usr/local/src/gcc-4.6.0/i686-pc-linux-gnu/libgcc': configure: error: cannot compute suffix of object files: cannot compile See `config.log' for more details. make[2]: *** [configure-stage1-target-libgcc] エラー 1 make[2]: ディレクトリ `/usr/local/src/gcc-4.6.0' から出ます make[1]: *** [stage1-bubble] エラー 2 make[1]: ディレクトリ `/usr/local/src/gcc-4.6.0' から出ます make: *** [all] エラー 2 エラー出たよ・・・ 参考リンク:http://yazawa-log.blogspot.com/2010/09/1-centos55gcc451.html 上記サイトを参考にして探して行ってみた・・・ # find ./* -name config.log | grep libgcc # vi ./i686-pc-linux-gnu/libgcc/config.log ログ内をerrorで検索したら・・・ サイトと同じようなエラーが出てる・・・ /usr/local/src/gcc-4.6.0/host-i686-pc-linux-gnu/gcc/cc1: error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory mpcのlibを確認 # ls -l /usr/local/mpc-0.9/lib/ # export LD_LIBRARY_PATH=/usr/local/lib # make clean # ./configure --prefix=/usr/local/gcc-4.6.0 --with-gmp=/usr/local/gmp-5.0.2 --with-mpfr=/usr/local/mpfr-3.0.1 --with-mpc=/usr/local/mpc-0.9 # make mv tmp2-tm.texi tmp-tm.texi /bin/sh ../.././gcc/../move-if-change tmp-tm.texi tm.texi make[3]: ディレクトリ `/usr/local/src/gcc-4.6.0/host-i686-pc-linux-gnu/gcc' から出ます Checking multilib configuration for libgcc... Configuring stage 1 in i686-pc-linux-gnu/libgcc configure: loading cache ./config.cache checking for --enable-version-specific-runtime-libs... no checking for a BSD-compatible install... /usr/bin/install -c checking for gawk... gawk checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking for i686-pc-linux-gnu-ar... ar checking for i686-pc-linux-gnu-lipo... lipo checking for i686-pc-linux-gnu-nm... /usr/local/src/gcc-4.6.0/host-i686-pc-linux-gnu/gcc/nm checking for i686-pc-linux-gnu-ranlib... ranlib checking for i686-pc-linux-gnu-strip... strip checking whether ln -s works... yes checking for i686-pc-linux-gnu-gcc... /usr/local/src/gcc-4.6.0/host-i686-pc-linux-gnu/gcc/xgcc -B/usr/local/src/gcc-4.6.0/host-i686-pc-linux-gnu/gcc/ -B/usr/local/gcc-4.6.0/i686-pc-linux-gnu/bin/ -B/usr/local/gcc-4.6.0/i686-pc-linux-gnu/lib/ -isystem /usr/local/gcc-4.6.0/i686-pc-linux-gnu/include -isystem /usr/local/gcc-4.6.0/i686-pc-linux-gnu/sys-include checking for suffix of object files... configure: error: in `/usr/local/src/gcc-4.6.0/i686-pc-linux-gnu/libgcc': configure: error: cannot compute suffix of object files: cannot compile See `config.log' for more details. make[2]: *** [configure-stage1-target-libgcc] エラー 1 make[2]: ディレクトリ `/usr/local/src/gcc-4.6.0' から出ます make[1]: *** [stage1-bubble] エラー 2 make[1]: ディレクトリ `/usr/local/src/gcc-4.6.0' から出ます make: *** [all] エラー 2 また、エラーかよ!! # vi ./i686-pc-linux-gnu/libgcc/config.log 今度は、こんなんだった・・・orz /usr/local/src/gcc-4.6.0/host-i686-pc-linux-gnu/gcc/cc1: error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory とりあえず、似たような感じで対処してみる・・・ # export MPFR_LIBRARY_PATH=/usr/local/mpfr-3.0.1/lib # make clean # make 結局同じだった・・・どないせーと? gcc-4.2.0は簡単に入ったのに・・・なんてこったい・・・/(^o^)\ 一旦削除 # rm -rf gmp-5.0.2 # rm -rf mpfr-3.0.1 # rm -rf mpc-0.9 参考にしたサイトと同じインストールで再度実行してみる gmpインストール ダウンロードディレクトリ:/usr/local/src インストールディレクトリ:デフォルト # wget ftp://ftp.gmplib.org/pub/gmp-5.0.2/gmp-5.0.2.tar.gz # tar zxvf gmp-5.0.2.tar.gz # cd gmp-5.0.2 # ./configure # make # make install mpfrインストール ダウンロードディレクトリ:/usr/local/src インストールディレクトリ:デフォルト # wget http://www.mpfr.org/mpfr-current/mpfr-3.0.1.tar.gz # tar zxvf mpfr-3.0.1.tar.gz # cd mpfr-3.0.1 # ./configure # make # make install mpcインストール ダウンロードディレクトリ:/usr/local/src インストールディレクトリ:デフォルト # wget http://www.multiprecision.org/mpc/download/mpc-0.9.tar.gz # tar zxvf mpc-0.9.tar.gz # cd mpc-0.9 # ./configure # make # make install # echo $LD_LIBRARY_PATH # export LD_LIBRARY_PATH=/usr/local/lib (http://gcc.gnu.org/ml/gcc-help/2008-08/msg00309.html) 再度の再度、gcc-4.6.0をコンパイルしてみる # cd gcc-4.6.0 # ./configure --prefix=/usr/local/gcc-4.6.0 # make # make install # cd /usr/local/gcc-4.6.0/bin # ./gcc -v 組み込み spec を使用しています。 COLLECT_GCC=./gcc COLLECT_LTO_WRAPPER=/usr/local/gcc-4.6.0/libexec/gcc/i686-pc-linux-gnu/4.6.0/lto-wrapper ターゲット: i686-pc-linux-gnu configure 設定: ./configure --prefix=/usr/local/gcc-4.6.0/ スレッドモデル: posix gcc バージョン 4.6.0 (GCC) 一応デフォルトを確認 # gcc -v Using built-in specs. Target: i386-redhat-linux コンフィグオプション: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --disable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux スレッドモデル: posix gcc バージョン 4.1.2 20080704 (Red Hat 4.1.2-50) はぁ・・・やっと入った・・・疲れた・・・ それにしても、makeの時間が長すぎる!!!! おまけ ---- なんか、知ってる人に聞いたらgccのビルドインストールするには、 2フェーズ取る必要があるらしい・・・(知らなかった) 流れ的にはこんなん 1) configure にて もう一度コンパイルするオプションを設定する (あるらしい・・・) 2) 古いgccコンパイラでコンパイル 3) 新しいgccコンパイラでもう一度コンパイル 詳しくは、gccの公式サイトにいってインストールの手順を見てくれ・・・ 俺に英語は無理だ・・・ (中学英語すらできなくて悪いか!!!!!!!!!!!!!!!!!!) ----