これが解決なのかどうか不安でたまらないけど、とりあえず動くので開発はこれでいいの、、かな?
条件
- Mac OS X El Capitan
- バージョン10.11.4(15E65)
- x86_64-darwin-15
ruby -rubygems -e 'puts Gem::Platform.new(RUBY_PLATFORM)'
- ruby2.3.0
- rbenv
現象
Installing therubyracer 0.12.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/withelmo/xxxxx/vendor/bundle/ruby/2.3.0/gems/therubyracer-0.12.2/ext/v8
/Users/withelmo/.rbenv/versions/2.3.0/bin/ruby -r ./siteconf20160322-81622-1f6lzl1.rb extconf.rb --with-v8-dir
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/withelmo/.rbenv/versions/2.3.0/bin/$(RUBY_BASE_NAME)
--with-pthreadlib
--without-pthreadlib
--with-objclib
--without-objclib
--enable-debug
--disable-debug
--with-v8-dir
/Users/withelmo/.rbenv/versions/2.3.0/lib/ruby/2.3.0/mkmf.rb:1733:in `dir_config': undefined method `split' for true:TrueClass (NoMethodError)
from /Users/withelmo/xxxxx/vendor/bundle/ruby/2.3.0/gems/libv8-3.16.14.13/ext/libv8/location.rb:49:in `configure'
from /Users/withelmo/xxxxx/vendor/bundle/ruby/2.3.0/gems/libv8-3.16.14.13/lib/libv8.rb:7:in `configure_makefile'
from extconf.rb:32:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/withelmo/xxxxx/vendor/bundle/ruby/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/therubyracer-0.12.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/withelmo/xxxxx/vendor/bundle/ruby/2.3.0/gems/therubyracer-0.12.2 for inspection.
Results logged to /Users/withelmo/xxxxx/vendor/bundle/ruby/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/therubyracer-0.12.2/gem_make.out
対策
gem install libv8 -v '3.16.14.11' -- --with-system-v8
brew tap homebrew/versions
brew install v8-315
# .bundle/config
BUNDLE_BUILD__THERUBYRACER: "--with-v8-dir=/usr/local/opt/v8-315"
bundle install
あとがき
毎回、 therubyracer
と nokogiri
には手を焼いている気がする
同じような誰かの参考に、役に立てられれば幸いです
この方法で解決しない場合もあるんではないかと
その場合は以下の記事を参考にいろいろ試していくしかない、のか?
- http://qiita.com/ganta/items/53f616b48e94d989952f
- http://qiita.com/puzzel/items/78638944ec2b0ffccb1b
- http://qiita.com/yakiimo23/items/eaf48164821897e3dde9
- http://qiita.com/akm/items/02c104fc3d39d68f96c7
- http://charlie23.hatenablog.jp/entry/2015/10/16/002055
- https://github.com/cowboyd/therubyracer/issues/359
- http://qiita.com/windhorn/items/394c10dea23d1e829cd1
- http://qiita.com/yohawing/items/9d3ecfd2904692ed0e05
- http://qiita.com/ooyabuh/items/32e7086917e29356b532
- http://qiita.com/chrischris0801/items/eb78fabdbaece22b3662