2010-10-03 87 views
0

在Mac OS X上安装hpricot时遇到问题。我怀疑它可能是rvm和brew之间的问题?在Mac OS X上使用rvm和brew安装hpricot

RVM 1.0.5 BREW 0.7

的思考?建议?谢谢!

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

/Users/dhaskin/.rvm/rubies/ruby-1.8.7-p302/bin/ruby extconf.rb 
checking for stdio.h... no 
*** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of 
necessary libraries and/or headers. Check the mkmf.log file for more 
details. You may need configuration options. 

Provided configuration options: 
    --with-opt-dir 
    --without-opt-dir 
    --with-opt-include 
    --without-opt-include=${opt-dir}/include 
    --with-opt-lib 
    --without-opt-lib=${opt-dir}/lib 
    --with-make-prog 
    --without-make-prog 
    --srcdir=. 
    --curdir 
    --ruby=/Users/dhaskin/.rvm/rubies/ruby-1.8.7-p302/bin/ruby 


Gem files will remain installed in /Users/dhaskin/.rvm/gems/ruby-1.8.7-p302/gems/hpricot-0.8.2 for inspection. 
Results logged to /Users/dhaskin/.rvm/gems/ruby-1.8.7-p302/gems/hpricot-0.8.2/ext/fast_xs/gem_make.out 

回答

0

ERROR: Failed to build gem native extension.checking for stdio.h... no是可疑的。 Hpricot以及许多其他Ruby宝石,需要编译一些代码,并且如果缺少开发包,将会失败。

您正在运行RVM,并且1.8.7版本在您的机器上是〜/ .rvm,所以看起来像是因为RVM需要编译Ruby,但失败听起来并非如此。你有/ Apple目录中安装了Apple的XCode吗?如果你没有安装它和/或目录不存在,你可以在你的MacOS安装光盘或苹果的开发者网站上找到安装程序:http://developer.apple.com/technologies/xcode.html

除此之外,我建议使用Nokogiri而不是Hpricot 。我在后面碰到了Hpricot的几个bug,这使得它无法满足我的需求,并转而使用Nokogiri。你会发现这两个宝石有相似的语法。 http://nokogiri.org/

+0

我宁愿nokogiri我自己;-)。 hpricot是http://github.com/aasmith/ofx-parser的依赖项。我确实已将XCode安装在默认位置。也许我会继续挖掘其他一些Ruby的OFX解析器。谢谢... – denishaskin 2010-10-03 21:50:54

0

原来这是一个XCode版本依赖项。将XCode更新为3.2.4解决了这个问题。