GOの導入

linux環境での導入について

今回はgccの拡張として作られているgccgoを導入してみる。
とりあえず、最新版をチェックアウトするためにsubverionでチェックアウトをする。

$mkdir gccgo
$svn co svn://gcc.gnu.org/svn/gcc/branches/gccgo gccgo

これで指定したディレクトリgccgoに最新版が保存される。
量が多く結構時間がかかったりするので注意。
subversionが分からない人はGoogleで探せば解りやすいサイトもいくつかあるので詳しい説明は割愛しとく。

で次に

$cd gccgo
$mkdir build
$cd build
$../configure --enable-languages=c,c++,go

を実行したのだけど、以下のエラーが出てきた。

configure: error: Building GCC requires GMP 4.2+ and MPFR 2.3.2+.
Try the --with-gmp and/or --with-mpfr options to specify their locations.
Copies of these libraries' source code 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 and/or MPFR 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を構築するにはGMPの4.2以上とMPRFの2.3.2以上がいるらしいので、下のリンクを参考にGMPとMPRFを取得。
http://www.switch-science.com/trac/wiki/AVR-GCC

インストール後にコマンド実行で完了しました。

$../configure --enable-languages=c,c++,go
$make
$make install

とりあえず、今日はここまで


参考サイト
GO オフィシャルページ
http://golang.org/doc/install.html