0

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

rvm 1.0.5 冲泡 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
4

2 回答 2

0

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

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

除此之外,我建议在 Hpricot 上使用 Nokogiri。不久前,我在 Hpricot 中遇到了几个错误,导致它无法满足我的需求,并切换到 Nokogiri。您会发现这两个 gem 具有相似的语法。http://nokogiri.org/

于 2010-10-03T19:11:57.350 回答
0

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

于 2010-10-05T14:27:02.527 回答