Ruby 在Mac OS X 10.5.8中安装Nokogiri gem的问题

Ruby 在Mac OS X 10.5.8中安装Nokogiri gem的问题,ruby,rubygems,rvm,nokogiri,osx-leopard,Ruby,Rubygems,Rvm,Nokogiri,Osx Leopard,我正试图在OS X Leopard(10.5.8)中的RVM管理的Ruby 1.8.7安装下安装Nokogiri gem 我得到以下错误: Building native extensions. This could take a while... ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension. /Users/user/.rvm/rubies/ruby-1.

我正试图在OS X Leopard(10.5.8)中的RVM管理的Ruby 1.8.7安装下安装Nokogiri gem

我得到以下错误:

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

        /Users/user/.rvm/rubies/ruby-1.8.7-p352/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... yes
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... yes
checking for exsltFuncRegister() in -lexslt... yes
checking for xmlHasFeature()... no
-----
The function 'xmlHasFeature' is missing from your installation of libxml2.  Likely this means that your installed version of libxml2 is old enough that nokogiri will not work well.  To get around this problem, please upgrade your installation of libxml2.

Please visit http://nokogiri.org/tutorials/installing_nokogiri.html for more help!
*** extconf.rb failed ***
我已经通过自制安装了最新的libxml2(brew install libxml2),所以我不知道还可以尝试什么


更新: 我尝试了Nokogiri网站上的说明,但我无法让Nokogiri gem安装识别libxml2

我通过自制软件安装并链接了libxml2和libxslt:

brew install libxml2 libxslt
brew link libxml2 libxslt
gem install nokogiri
错误消息已更改,但Nokogiri安装抱怨缺少libxml2:

...
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... yes
checking for xmlParseDoc() in -lxml2... no
-----
libxml2 is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies
已安装的libxml2版本是2.7.8


更新更新: 我尝试从自制中安装iconv库,看看是否可以解决在iconv.h中检查iconv_open()时出现的错误
。。。没有,所以我运行了以下命令:

brew install libiconv
brew link libiconv
brew install libxml2
gem install nokogiri
在完成安装后,我再次尝试安装nokogiri gem,以获得此错误消息,安装程序现在抱怨libiconv丢失了

hecking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... no
-----
libiconv is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
我不知道。

按照以下说明:您需要使用:

brew install libxml2 libxslt
brew link libxml2 libxslt
然后


您是否使用了这些或仅使用了
brew安装libxml2

请确保没有可用的Nokogiri版本:

use gem uninstall nokogiri
首先为Xcode安装命令行工具。请参阅“”

然后运行以下命令:

brew install libiconv
brew link libiconv
brew install libxml2
gem install nokogiri

现在它工作得很好,我试过了。

谢谢,我不敢相信我在nokogiri官方页面上错过了这样的文章。我想我在其他平台(甚至OSX10.6+)上安装nokogiri没有任何问题,所以我从来都不需要它。我只安装了软件包,但没有链接它们;我将尝试此解决方案,并让您知道发生了什么。我添加了一个更新,按照网站上的说明,我仍然无法安装它。最后,我更新了OS X版本,并通过标准方式使所有内容正常工作。请在您提供的代码片段中添加一些说明,以便您的答案更有意义。
brew install libxml2 libxslt
gem install nokogiri -- \
    --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.x/lib \
    --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.xx \
    --with-iconv-lib=/usr/lib \
    --with-iconv-include=/usr/local/include