宝石(Gem)的unf_ext无法构建本地扩展。

5

环境 => Mac OS Yosemite.

我拿到了一个使用 Ruby 2.1.3 的项目。 但是当我运行 bundle install 时,遇到了一个无法解决的错误。 gem unf_ext 出现了问题。

这里是终端的错误信息:

$ gem install unf_ext -v '0.0.6'
Building native extensions.  This could take a while...
ERROR:  Error installing unf_ext:
ERROR: Failed to build gem native extension.

/Users/vincent/.rvm/rubies/ruby-2.1.3/bin/ruby extconf.rb
checking for main() in -lstdc++... yes
checking for ruby/encoding.h... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling unf.cc
In file included from unf.cc:1:
In file included from ./unf/normalizer.hh:4:
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: *** [unf.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/vincent/.rvm/gems/ruby-2.1.3/gems/unf_ext-0.0.6 for inspection.
Results logged to /Users/vincent/.rvm/gems/ruby-2.1.3/extensions/x86_64-darwin-14/2.1.0-static/unf_ext-0.0.6/gem_make.out 

我尝试使用brew update和xcode select install, 但仍然无法正常工作。 有什么建议吗?

目前在 Github 上似乎存在一个未解决的问题:https://github.com/knu/ruby-unf/issues/11 - karlingen
请安装bundler gem时注意错误信息,特别是关于unf_ext v0.0.6的错误。您可以在stackoverflow.com/questions/29550738查看更多信息。 - karlingen
非常感谢!与链接相同。我通过从苹果开发者下载页面重新安装Xcode 6.2的OS X 10.10版本的Command-Line-Tools commandlinetoolsosx10.10forxcode6.2.dmg来解决了这个问题。 - March Hare
很高兴它解决了你的问题。我也将其发布为答案。 - karlingen
1个回答

3

这种情况发生在我的 Xcode 12.2 上,所以我暂时切换到了 12.1 版本。 - Manabu Nakazawa

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接