LoginSignup
11
10

More than 5 years have passed since last update.

gcc 4.9.2 をソースビルドする

Posted at

はじめに

gcc 4.9.2 が 10/30 にリリースされたので、ソースビルドしてみる。

変更点はこちら
https://gcc.gnu.org/gcc-4.9/changes.html

環境

Debian GNU/Linux 7

ダウンロード

適当に近いミラーサイトから落としてくる
https://gcc.gnu.org/mirrors.html

必要なパッケージの準備

cd gcc-4.9.2
./contrib/download_prerequisites

ビルド

公式のドキュメントによると、ビルドのディレクトリでやっているようなので

cd ../
mkdir gcc-build
cd gcc-build
../gcc-4.9.2/configure

なんかおこられた

configure: error: I suspect your system does not have 32-bit developement libraries (libc and headers). If you have them, rerun configure with --enable-multilib. If you do not have them, and want to build a 64-bit-only compiler, rerun configure with --disable-multilib.

とりあえず環境は64bitなので、 --disable-multilib をつけて再度行う

../gcc-4.9.2/configure --disable-multilib

通ったので、make する

make

make できたらインストールする
paco を使ってみる ( 参考URL )

sudo paco -lD "make install"

バージョンを確認して完了

$ gcc --version
gcc (GCC) 4.9.2
Copyright (C) 2014 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.

おわりに

コンパイルに死ぬほど時間がかかるので、ビルドを並列に行ったり(Nは自身の環境に合わせる)

make -jN

ビルドする言語を選択したりするといいかもしれない(C/C++だけビルドする例)

../gcc-4.9.2/configure --disable-multilib --enable-languages=c,c++
11
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
10