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

我试图在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。


更新更新:

我试图从homebrew安装iconv库,看看我是否可以解决错误checking for iconv_open() in iconv.h... no ,所以我跑了命令:

brew install libiconv
brew link libiconv

并且在完成安装之后,我尝试再次安装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.
-----

我无能为力。


按照http://nokogiri.org/tutorials/installing_nokogiri.html中的说明,您需要使用:

brew install libxml2 libxslt
brew link libxml2 libxslt

然后

gem install nokogiri

你使用过那些还是只有brew install libxml2


确保没有Nokogiri版本可用:

use gem uninstall nokogiri

首先安装Xcode的命令行工具。 请参阅“如何在Mac OS X 10.8 / Xcode 4.4上使用/安装gcc”。

然后运行以下命令:

brew install libxml2
gem install nokogiri

现在它运行良好,我试了一下。


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
链接地址: http://www.djcxy.com/p/10481.html

上一篇: Issue installing the Nokogiri gem in Mac OS X 10.5.8

下一篇: Secondary axis labels not working?