在OS X 10.9上安装kdtree,无法编译本机扩展

时间:2013-10-27 08:32:09

标签: ruby-on-rails gem kdtree

您可能会在计算机上编译kdtree gem的原生扩展时遇到问题。该错误可能看起来有点像:

X-MacBook-Pro:Pitot X$ sudo gem install kdtree
Building native extensions.  This could take a while...
ERROR:  Error installing kdtree:
ERROR: Failed to build gem native extension.

/Users/X/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb
creating Makefile

make
compiling kdtree.c
In file included from /Users/X/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby.h:32,
             from kdtree.c:1:
/Users/X/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/ruby.h:48:21: error: string.h: No such file or directory
/Users/X/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/ruby.h:58:21: error: stdint.h: No such file or directory
/Users/X/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/ruby.h:61:23: error: inttypes.h: No such file or directory
/Users/X/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/ruby.h:65:19: error: stdio.h: No such file or directory

<snip>

1 个答案:

答案 0 :(得分:4)

这可以通过运行:

来解决
xcode-select --install

然后跑步:

sudo gem install kdtree

在运行bundler之前。