在 Ruby China 中已经有人问过关于该问题了,但从这些回答中自己没有找到可以解决本问题的好方式(在 Google 上也搜索了),那位大神拯救一下小白。
安装环境是 rvm1.27.0 + ruby1.9.3 + Rails3.2.14,在项目目录下进行 bundle install 后会报下面的错误:
Installing therubyracer 0.12.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/zhujinshou/.rvm/rubies/ruby-1.9.3-p551/bin/ruby -r ./siteconf20160419-54804-1n7e3ld.rb extconf.rb --use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... no
*** 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
--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/zhujinshou/.rvm/rubies/ruby-1.9.3-p551/bin/ruby
--with-pthreadlib
--without-pthreadlib
--with-objclib
--without-objclib
--enable-debug
--disable-debug
--with-v8-dir
--without-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/
/Users/zhujinshou/.rvm/gems/ruby-1.9.3-p551@tsinova_web/gems/libv8-3.16.14.13/ext/libv8/location.rb:50:in `configure': You have chosen to use the version of V8 found on your system (Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.13 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location
thanks,
The Mgmt
from /Users/zhujinshou/.rvm/gems/ruby-1.9.3-p551@tsinova_web/gems/libv8-3.16.14.13/lib/libv8.rb:7:in `configure_makefile'
from extconf.rb:32:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/zhujinshou/.rvm/gems/ruby-1.9.3-p551@tsinova_web/gems/therubyracer-0.12.1 for inspection.
Results logged to /Users/zhujinshou/.rvm/gems/ruby-1.9.3-p551@tsinova_web/extensions/x86_64-darwin-15/1.9.1/therubyracer-0.12.1/gem_make.out
错误就像上面那样:Failed to build gem native extension. 网上给的装上 libv8 的方法是加上 -- --with-system-v8 但是这明显指标不治本 求助呀,江湖告急,请高手支援!