2016-03-02 102 views
2

我一直在試圖安裝gem,therubyracer與OS X El Capitan for a Rails應用程序的Mac上,但我不斷收到與-rdynamic標誌關聯的錯誤,從而導致無法構建本機擴展。由於mac上的編譯器問題而無法安裝therubyracer gem?

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,但仍然沒有解決問題。我能做些什麼來解決這個問題?

回答

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 

和不包安裝。我認爲它可以解決你的問題。

+0

謝謝,我想我明白了。我不得不將gcc編譯器更改爲4.2版。出於某種原因,較新的gcc版本不會忽略-rdynamic標誌,該標誌僅用於在Linux上進行編譯,並不實際與Windows和osx兼容[根據此問題](http://stackoverflow.com/questions)/29534519 /爲什麼-GCC-犯規 - 認識 - rdynamic選項) –

相關問題