使用rvm和brew在Mac OS X上安装hpricot

发布于 2024-09-25 21:38:02 字数 1140 浏览 2 评论 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

Having problems installing hpricot on Mac OS X. I suspect it might be an issue between rvm and brew?

rvm 1.0.5
brew 0.7

Thoughts? Suggestions? Thanks!

$ 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一城柳絮吹成雪 2024-10-02 21:38:02

错误:无法构建 gem 本机扩展。检查 stdio.h... 否 是可疑的。 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/

ERROR: Failed to build gem native extension. and checking for stdio.h... no are suspicious. Hpricot, along with many other Ruby gems, needs to compile some code and will fail if the development package is missing.

You are running RVM and 1.8.7 is in ~/.rvm on your machine, so it looks like it is because RVM would have to compile Ruby, but the failure sounds like it isn't. Do you have Apple's XCode installed in the /Developer directory? If you didn't install it and/or the directory isn't there, you can find the installer on your MacOS install discs, or at Apple's Developer site: http://developer.apple.com/technologies/xcode.html

That aside, I'd recommend using Nokogiri over Hpricot. I ran into several bugs in Hpricot a while back that made it unusable for my needs, and switched to Nokogiri. You'll find the two gems have similar syntax. http://nokogiri.org/

鹤仙姿 2024-10-02 21:38:02

事实证明这是 XCode 版本依赖性。将 XCode 更新到 3.2.4 解决了这个问题。

Turns out this was an XCode version dependency. Updating XCode to 3.2.4 resolved this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文