ruby-on-rails - 使用 osx Yosemite 安装 ruby​​racer 时出错

标签 ruby-on-rails ruby therubyracer

我已经升级了我的 ruby​​ 版本,当我安装 ruby​​ racer 时,我收到以下错误。如下安装libv8 gem 安装 libv8 -- --with-v8-lib

ERROR:  Error installing therubyracer:
ERROR: Failed to build gem native extension.

/Users/ViswaMani/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.6
Using compiler: /usr/bin/c++ (clang version 6.1.0)
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: /Users/ViswaMani/.rvm/gems/ruby-2.1.1@futura/gems/libv8-3.16.14.11/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o has no symbols
In file included from ../src/accessors.cc:28:
In file included from ../src/v8.h:60:
In file included from ../src/objects-inl.h:38:
In file included from ../src/elements.h:33:
In file included from ../src/heap.h:35:
In file included from ../src/incremental-marking.h:33:
In file included from ../src/mark-compact.h:32:
../src/spaces.h:896:26: error: 'this' pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to true [-Werror,-Wtautological-undefined-compare]
  bool exists() { return this != NULL && code_range_ != NULL; }
                         ^~~~    ~~~~
../src/spaces.h:898:9: error: 'this' pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to false [-Werror,-Wtautological-undefined-compare]
    if (this == NULL || code_range_ == NULL) return false;
        ^~~~    ~~~~
2 errors generated.
make[1]: *** [/Users/ViswaMani/.rvm/gems/ruby-2.1.1@futura/gems/libv8-3.16.14.11/vendor/v8/out/x64.release/obj.target/v8_base/src/accessors.o] Error 1
make: *** [x64.release] Error 2
/Users/ViswaMani/.rvm/gems/ruby-2.1.1@futura/gems/libv8-3.16.14.11/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/ViswaMani/.rvm/gems/ruby-2.1.1@futura/gems/libv8-3.16.14.11/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/ViswaMani/.rvm/gems/ruby-2.1.1@futura/gems/libv8-3.16.14.11/ext/libv8/location.rb:35:in `each'
    from /Users/ViswaMani/.rvm/gems/ruby-2.1.1@futura/gems/libv8-3.16.14.11/ext/libv8/location.rb:35:in `verify_installation!'
    from /Users/ViswaMani/.rvm/gems/ruby-2.1.1@futura/gems/libv8-3.16.14.11/ext/libv8/location.rb:26:in `install!'

最佳答案

如果您已经安装了 libv8,请将其删除并重新安装。

gem uninstall libv8
brew install v8
gem install therubyracer
gem install libv8 -v '3.16.14.3' -- --with-system-v8

或者,您可以安装您的特定版本,

gem install libv8 -v 'XX.XX.XX' -- --with-system-v8 

关于ruby-on-rails - 使用 osx Yosemite 安装 ruby​​racer 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31423882/

相关文章:

ruby-on-rails - 如何使用 ActiveRecord 或 Mongoid 编写此查询?

ruby-on-rails - 如何在命名空间内部的 View 中呈现命名空间外部的 Rails 部分?

ruby-on-rails - 在 Rails 4 中引发自定义错误

ruby-on-rails - 结合 ActionCable 和 I18n

ruby - ruby 中的过程和数据抽象

ruby-on-rails - Rubyzip:将 zip 文件直接导出到 S3 而无需将 tmpfile 写入磁盘?

ruby-on-rails - 有没有办法在 Windows 中安装 therubyracer?

ruby-on-rails - therubyracer gem 安装错误 - mac 10.9

ruby-on-rails - 类型错误 : Object doesn't support this property or method

ruby-on-rails - Ruby on Rails 中的电子邮件模板