2010-10-03 137 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解決了這個問題。