make buildworld 失敗

CXXFLAGS+ を設定したら ports から buildworld から全て失敗。
やっぱりよくわからないことはするもんじゃないな・・・。


とりあえず気を取り直して ccache を使う時のメモ。
distcc は分散するホストがないので割合します。
distcc も使ってみたい方は otsune 様のところをご覧下さい。
otsune's FreeBSD memo :: ccacheとdistccでビルドを高速に


まずは普通に ports からインストール。

$ cd /usr/ports/devel/ccache
$ make install clean
$ rehash


もしくは portinstall でも。 ( portupgrade を導入してあることが前提です )

$ portinstall devel/ccache
$ rehash


インストールが終わったら環境変数を設定。
まず /etc/csh.cshrc に記述します。

$ mkdir /var/db/ccache
$ /etc/csh.cshrc
setenv PATH /usr/local/libexec/ccache/:$PATH
setenv CCACHE_PATH /usr/bin:/usr/local/bin
setenv CCACHE_DIR /var/db/ccache
setenv CCACHE_LOGFILE /var/log/ccache.log


次に /etc/make.conf に記述します。

.if !defined(NOCCACHE)
.if ${.CURDIR:M/usr/src*}
CC=/usr/local/libexec/ccache/cc
CXX=/usr/local/libexec/ccache/c++
.else
CC=cc
CXX=c++
.endif
.else
CC=/usr/bin/cc
CXX=/usr/bin/c++
.endif


06/07/03 18:00 追記:上記の記述は古い内容の物ですので、参考にされた方は下記の記述に書き直してください。

.if (!empty(.CURDIR:M/usr/src*) || !empty(.CURDIR:M/usr/obj*)) && !defined(NOCCACHE)
CC=/usr/local/libexec/ccache/world-cc
CXX=/usr/local/libexec/ccache/world-c++
.endif

もしくは /usr/local/share/doc/ccache/ccache-howto-freebsd.txt を見ておくと幸せになれるかもしれません。
ご指摘くださった otsune 様、ありがとうございました。


あとは make buildworld なり make buildkernel なり ports なりを make して、次回 make する時に効果があるらしいです。
らしいですっていうのは 上記でも書きましたがずっと make に失敗していて効果を体験出来なかったからです orz

$ ccache
ccache, a compiler cache. Version 2.4
Copyright Andrew Tridgell, 2002

Usage:
        ccache [options]
        ccache compiler [compile options]
        compiler [compile options]    (via symbolic link)

Options:
-s                      show statistics summary
-z                      zero statistics
-c                      run a cache cleanup
-C                      clear the cache completely
-F <maxfiles>           set maximum files in cache
-M <maxsize>            set maximum size of cache (use G, M or K)
-h                      this help page
-V                      print version number


今回は distcc について説明しませんでしたが、分散するホストがあればカーネル再構築などにかかる時間はかなり短縮されそうです。
こういうのクラスタリングっていうんでしたっけ?
Apache 2.2 でロードバランスが使いやすくなったらしいですが、そのロードバランス ( 負荷分散 ) もクラスタリングと言うらしいですね。
今ちょっと気になって調べてみたんですが、結構興味があるので後ほどメモるかも。


TODO: make.conf で指定出来るオプションや活用法など。