为什么安装gem libv8 3.11.8.17适用于ruby-2.1.2,但是使用ruby-2.3.1会出错?

时间:2016-09-06 15:14:10

标签: ruby libv8

我使用RVM来管理我的宝石。

的Gemfile:

source 'https://rubygems.org'
gem 'libv8', '~> 3.11.8'

尝试 ruby​​-2.1.2

Mac OSX上的#1终端命令
rvm use ruby-2.1.2@test
rm Gemfile.lock
bundle install

以上工作正常。现在尝试 ruby​​-2.3.1

#2 Mac OSX上的终端命令
rvm use ruby-2.3.1@test
rm Gemfile.lock
bundle install

这会产生错误:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/fullname/.rvm/gems/ruby-2.3.1@test/gems/libv8-3.11.8.17/ext/libv8
/Users/fullname/.rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20160906-88565-91zqg8.rb extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.12
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Using compiler: /usr/bin/g++
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
../src/cached-powers.cc:136:18: error: unused variable 'kCachedPowersLength' [-Werror,-Wunused-const-variable]
static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers);
                 ^
1 error generated.
make[1]: *** [/Users/fullname/.rvm/gems/ruby-2.3.1@test/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o] Error 1
make: *** [x64.release] Error 2
/Users/fullname/.rvm/gems/ruby-2.3.1@test/gems/libv8-3.11.8.17/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/fullname/.rvm/gems/ruby-2.3.1@test/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a'to exist, but it was not found (Libv8::Location::Vendor::ArchiveNotFound)
    from /Users/fullname/.rvm/gems/ruby-2.3.1@test/gems/libv8-3.11.8.17/ext/libv8/location.rb:35:in `each'
    from /Users/fullname/.rvm/gems/ruby-2.3.1@test/gems/libv8-3.11.8.17/ext/libv8/location.rb:35:in `verify_installation!'
    from /Users/fullname/.rvm/gems/ruby-2.3.1@test/gems/libv8-3.11.8.17/ext/libv8/location.rb:26:in `install!'
    from extconf.rb:7:in `<main>'
GYP_GENERATORS=make \
    build/gyp/gyp --generator-output="out" build/all.gyp \
                  -Ibuild/standalone.gypi --depth=. \
                  -Dv8_target_arch=x64 \
                  -S.x64  -Dv8_can_use_vfp_instructions=true
  CXX(target) /Users/fullname/.rvm/gems/ruby-2.3.1@test/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
  CXX(target) /Users/fullname/.rvm/gems/ruby-2.3.1@test/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
  CXX(target) /Users/fullname/.rvm/gems/ruby-2.3.1@test/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o
  CXX(target) /Users/fullname/.rvm/gems/ruby-2.3.1@test/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o
  CXX(target) /Users/fullname/.rvm/gems/ruby-2.3.1@test/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o

extconf failed, exit code 1

Gem files will remain installed in /Users/fullname/.rvm/gems/ruby-2.3.1@test/gems/libv8-3.11.8.17 for inspection.
Results logged to /Users/fullname/.rvm/gems/ruby-2.3.1@test/extensions/x86_64-darwin-15/2.3.0/libv8-3.11.8.17/gem_make.out

在Linux Debian上,两者都运行良好。

我想知道为什么这对ruby-2.1.2有效,而不是对MacOSX 10.11.6上的ruby-2.3.1有效?

2 个答案:

答案 0 :(得分:0)

这似乎是一个与此类似的问题:https://github.com/cowboyd/libv8/issues/135

答案 1 :(得分:0)

gem install libv8 -v '3.11.8.17' -- --with-system-v8