【问题标题】:Install hpricot on Mac OS X with rvm and brew使用 rvm 和 brew 在 Mac OS X 上安装 hpricot
【发布时间】:2011-04-20 12:04:25
【问题描述】:

在 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

【问题讨论】:

    标签: ruby macos rvm homebrew


    【解决方案1】:

    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

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

    【讨论】:

    • 我自己更喜欢 nokogiri ;-) 。 hpricot 是 github.com/aasmith/ofx-parser 的依赖项。而且我确实在默认位置安装了 XCode。也许我会继续挖掘其他一些 ruby​​ OFX 解析器。谢谢...
    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-10-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-16
      • 2012-08-05
      相关资源
      最近更新 更多