El Capitan libv8がインストール出来ない
OSX 10.11 El Capitanにアップグレードした際に、Ruby on Railsの環境構築で失敗したので個人的なメモ。
## bundle installで失敗したgem
- libv8
- therubyracer
## libv8のエラー
こんな感じのエラーが出た
```
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/var/rbenv/versions/2.1.7/bin/ruby extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.10
Using compiler: /usr/bin/c++ (clang version 7.0.0)
In file included from ../src/conversions.cc:32:
In file included from ../src/conversions-inl.h:43:
../src/scanner.h:444:5: error: unused typedef '__StaticAssertTypedef__444' [-Werror,-Wunused-local-typedef]
STATIC_ASSERT(kCharacterLookaheadBufferSize == 1);
^
../src/checks.h:283:30: note: expanded from macro 'STATIC_ASSERT'
#define STATIC_ASSERT(test) STATIC_CHECK(test)
^
../src/checks.h:251:5: note: expanded from macro 'STATIC_CHECK'
SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__)
^
../src/checks.h:240:32: note: expanded from macro 'SEMI_STATIC_JOIN'
#define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b)
^
../src/checks.h:241:39: note: expanded from macro 'SEMI_STATIC_JOIN_HELPER'
#define SEMI_STATIC_JOIN_HELPER(a, b) a##b
^
:63:1: note: expanded from here
__StaticAssertTypedef__444
...
```
## apple-gcc42のインストール
`apple-gcc42`をインストールすることで回避できた。
```
$ brew tap homebrew/dupes
$ brew install apple-gcc42
$ export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2
$ export CXX=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2
$ export CPP=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2
$ gem install therubyracer
```
## インストールされたgemのバージョン
```
$ gem list --local
libv8 (3.16.14.11 x86_64-darwin-15)
therubyracer (0.12.2)
```
あとはいつも通り、`bundle install`すればOK
## 参考
https://www.snip2code.com/Snippet/674372/Fix-libv8-in-El-Capitan