therubyracer gem 安装错误 - mac 10.9

Posted

技术标签:

【中文标题】therubyracer gem 安装错误 - mac 10.9【英文标题】:therubyracer gem error on install - mac 10.9 【发布时间】:2013-11-15 09:57:37 【问题描述】:

我正在尝试建立一个现有项目。当我运行 bundle install 时,我在 therubyracer gem 上收到以下错误:

Installing therubyracer (0.10.2)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/***/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
checking for main() in -lobjc... yes
creating Makefile

make
compiling rr.cpp
clang: warning: argument unused during compilation: '-rdynamic'
rr.cpp:48:1: warning: control reaches end of non-void function [-Wreturn-type]

^
1 warning generated.
compiling v8.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_array.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_callbacks.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_context.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_date.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_debug.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_exception.cpp
clang: warning: argument unused during compilation: '-rdynamic'
v8_exception.cpp:10:16: warning: unused variable 'stack' [-Wunused-variable]
  static void* stack[20];
               ^
1 warning generated.
compiling v8_external.cpp
clang: warning: argument unused during compilation: '-rdynamic'
v8_external.cpp:10:9: warning: unused variable 'references' [-Wunused-variable]
  VALUE references;
        ^
1 warning generated.
compiling v8_function.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_handle.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_locker.cpp
clang: warning: argument unused during compilation: '-rdynamic'
v8_locker.cpp:45:5: warning: control reaches end of non-void function [-Wreturn-type]
    
    ^
v8_locker.cpp:85:5: warning: control reaches end of non-void function [-Wreturn-type]
    
    ^
2 warnings generated.
compiling v8_message.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_object.cpp
clang: warning: argument unused during compilation: '-rdynamic'
v8_object.cpp:77:19: warning: unused variable 'proto' [-Wunused-variable]
    Handle<Value> proto(rr_rb2v8(prototype));
                  ^
1 warning generated.
compiling v8_script.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_string.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_template.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_try_catch.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_v8.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_value.cpp
clang: warning: argument unused during compilation: '-rdynamic'
v8_value.cpp:100:9: warning: unused function 'ToInt32' [-Wunused-function]
  VALUE ToInt32(VALUE self) 
        ^
1 warning generated.
compiling v8_weakref.cpp
clang: warning: argument unused during compilation: '-rdynamic'
linking shared-object v8.bundle
clang: error: no such file or directory: '/Users/ianseabock/.rvm/gems/ruby-1.9.3-p448/gems/libv8-3.3.10.4/lib/libv8/build/v8/libv8.a'
make: *** [v8.bundle] Error 1


Gem files will remain installed in /Users/ianseabock/.rvm/gems/ruby-1.9.3-p448/gems/therubyracer-0.10.2 for inspection.
Results logged to /Users/ianseabock/.rvm/gems/ruby-1.9.3-p448/gems/therubyracer-0.10.2/ext/v8/gem_make.out

An error occurred while installing therubyracer (0.10.2), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.10.2'` succeeds before bundling.

【问题讨论】:

"gem install therubyracer -v '0.10.2'" on osx mavericks not installing 的可能重复项 您必须使用 g++ 4.2 编译libv8,详情请参阅链接问题。 【参考方案1】:

使用 ruby​​ 2.2.0,它应该可以工作。

对我来说,它不适用于具有任何可能设置的 ruby​​ 2.1.x。 使用 ruby​​ 2.2.0 运行顺利。

【讨论】:

【参考方案2】:

按照以下步骤操作:

Terminal

gem uninstall libv8

Gemfile

gem 'therubyracer'
bundle install

就是这样。你的 libv8 和 therubyracer 版本不匹配,所以你得到了那个错误。

【讨论】:

以上是关于therubyracer gem 安装错误 - mac 10.9的主要内容,如果未能解决你的问题,请参考以下文章

Rails 4.0.0 Ruby 2.0 therubyracer gem 安装错误

如何在 mac 上安装 therubyracer? “gem install therubyracer -v”不工作

由于 Mac 上的编译器问题,无法安装 therubyracer gem?

gem 在 OSX 10.15 上安装 therubyracer -v 0.12.3

无法在 M1 Macbook Pro 中安装“therubyracer v0.12.3”gem

在 OSX 10.11 El Capitan 上安装 therubyracer gem