2015-04-12 120 views
6

有許多人有類似的問題,我已經在其他機器過去的其中之一,沒有任何解決方案似乎工作 - 我似乎也有不同的錯誤比別人誰也有類似的問題:無法安裝therubyracer乾淨的安裝優勝美地和乾淨的版本的紅寶石

Building native extensions. This could take a while... 
ERROR: Error installing therubyracer: 
    ERROR: Failed to build gem native extension. 

    /Users/username/.rvm/rubies/ruby-2.0.0-p353/bin/ruby -r ./siteconf20150412-25981-y7cvt6.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 
clang: warning: argument unused during compilation: '-rdynamic' 
In file included from accessor.cc:1: 
In file included from ./rr.h:6: 
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/vector:265: 
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__bit_reference:15: 
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/algorithm:628: 
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:604: 
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iterator:341:10: fatal error: '__debug' file not found 
#include <__debug> 
     ^
1 error generated. 
make: *** [accessor.o] Error 1 

make failed, exit code 2 

Gem files will remain installed in /Users/ecnalyr/.rvm/gems/[email protected]/gems/therubyracer-0.12.2 for inspection. 
Results logged to /Users/ecnalyr/.rvm/gems/[email protected]/extensions/x86_64-darwin-14/2.0.0/therubyracer-0.12.2/gem_make.out 

當運行:

gem install therubyracer -v '0.12.2' 

或者乾脆

bundle install 

therubyracer包含在我的gemfile中。

我正在運行Yosemite 10.10.3,Ruby 2.0.0-p353,我卸載了所有內容,並嘗試了gem install libv8 -- --with-system-v8解決方案,經常遇到這類問題,但未找到解決方案。

回答

7

我能夠通過重新安裝Command Line Tools for XCode 6.2(而不是XCode 6.3)來解決此問題。

還有更多關於Stack Overflow 29529455的討論。

+1

你是如何卸載6.3並安裝6.2的 –

+0

你不需要,至少我沒有。 –

+0

它解決了我的問題。有用。 –

11

創建臨時文件'__debug'爲我解決了這個問題。

運行這個命令在終端:

回聲的#define _LIBCPP_ASSERT(X,M)((無效)0)'| sudo tee -a/Library/Developer/CommandLineTools/usr/include/C++/v1/__ debug>/dev/null

+0

沒有其他解決方案的幫助。這個解決了它!謝謝 – Kamel