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

时间:2016-03-02 08:02:48

标签: ruby-on-rails ruby macos rubygems therubyracer

我一直在尝试使用OS X El Capitan在我的Mac上安装gem,therubyracer用于rails应用程序,但是我一直收到与-rdynamic标志相关的错误,导致无法构建本机扩展。

Amory:coursequestionbank masonscott$ gem install therubyracer
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
ERROR: Failed to build gem native extension.

/Users/masonscott/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20160301-14168-1g6b007.rb extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling accessor.cc
g++: error: unrecognized command line option '-rdynamic'
make: *** [accessor.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/masonscott/.rvm/gems/ruby-2.2.1/gems/therubyracer-0.12.2 for inspection.
Results logged to /Users/masonscott/.rvm/gems/ruby-2.2.1/extensions/x86_64-darwin-14/2.2.0-static/therubyracer-0.12.2/gem_make.out

我已经尝试过到处搜索,似乎编译器应该忽略rdynamic标志,但由于某种原因,我没有。我尝试通过gcc更新到gcc5,但仍然无法解决问题。我该怎么做才能解决这个问题?

1 个答案:

答案 0 :(得分:0)

我在安装therubyracer时遇到问题(因为libv8存在问题)。我想你可以试试这个。

$ gem uninstall libv8
$ gem install therubyracer -v '0.12.0'

另一种方式如下

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

并进行捆绑安装。我认为它可以解决你的问题。