6

有很多人有类似的问题,我过去在其他机器上也是其中之一,而且那里的解决方案似乎都不起作用——我似乎也有与其他有类似问题的人不同的错误:

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/ruby-2.0.0-p353@canopy/gems/therubyracer-0.12.2 for inspection.
Results logged to /Users/ecnalyr/.rvm/gems/ruby-2.0.0-p353@canopy/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了经常出现此类问题的解决方案,但没有找到解决方案。

4

2 回答 2

11

创建一个临时文件“__debug”为我解决了这个问题。

在终端中运行此命令:

echo '#define _LIBCPP_ASSERT(x, m) ((void)0)' | sudo tee -a /Library/Developer/CommandLineTools/usr/include/c++/v1/__debug > /dev/null

于 2015-04-16T05:42:33.977 回答
7

我能够通过重新安装XCode 6.2 的命令行工具(而不是 XCode 6.3 的命令行工具)来解决这个问题。

Stack Overflow 29529455中有更多讨论。

于 2015-04-13T10:43:16.210 回答