2015-04-12 97 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