LLVM-gcc でも clang でもコンパイルできない Homebrew パッケージへの対処

GCC is GONE

 Mac OSX Lion では gcc が消滅している。よって、標準のコンパイラでは入れられないパッケージが存在している。しかし Homebrew には親切にも以下のようなインストールモードが用意されている。

brew install --interactive hdf5

 こうすると bash が立ち上がる。このパッケージは llvm-gcc でも clang でもコンパイル出来なかったので、自前で導入している gcc-4.6 を使用してインストールする。

==> Entering interactive mode
Type `exit' to return and finalize the installation
Install to this prefix: /usr/local/Cellar/octave/3.6.2
CC=/usr/local/bin/gcc-4.6.3 CXX=/usr/local/bin/g++-4.6.3 ./configure --prefix=/usr/local/Cellar/octave/3.6.2 
bash-3.2$ make
bash-3.2$ make install
bash-3.2$ exit

 もし CMakeLists.txt が存在するなら僕はこちらを選ぶ。

==> Entering interactive mode
Type `exit' to return and finalize the installation
Install to this prefix: /usr/local/Cellar/hdf5/1.8.9
bash-3.2$ cmake . -DCMAKE_C_COMPILER=gcc-4.6 -DCMAKE_CXX_COMPILER=g++-4.6 -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/hdf5/1.8.9
bash-3.2$ make
bash-3.2$ make install
bash-3.2$ exit

 こうして無事に導入することができた。