Issue installing the Nokogiri gem in Mac OS X 10.5.8

I'm trying to install the Nokogiri gem under an RVM managed Ruby 1.8.7 installation in OS X Leopard (10.5.8).

I'm getting the following error:

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 ***

I have the latest libxml2 installed via homebrew (brew install libxml2), so I don't know what else to try.


Update :

I tried the instructions from the Nokogiri website and I can't get the Nokogiri gem installation to recognize libxml2.

Per the instructions I installed and linked libxml2 and libxslt via homebrew:

brew install libxml2 libxslt
brew link libxml2 libxslt
gem install nokogiri

The error message has changed, but the Nokogiri installation complains that libxml2 is missing:

...
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

The installed libxml2 version is 2.7.8.


Update update:

I tried installing the iconv library from homebrew to see if I could solve the error checking for iconv_open() in iconv.h... no , so I ran the commands:

brew install libiconv
brew link libiconv

And after finishing the installation, I tried to install the nokogiri gem again, to get this error message, where the installer now complains that libiconv is missing

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.
-----

I'm clueless.


Per the directions at: http://nokogiri.org/tutorials/installing_nokogiri.html you needed to use:

brew install libxml2 libxslt
brew link libxml2 libxslt

then

gem install nokogiri

Did you use those or only brew install libxml2 ?


Make sure there is no Nokogiri version available:

use gem uninstall nokogiri

First install the command-line tool for Xcode. Refer to "How to use/install gcc on Mac OS X 10.8 / Xcode 4.4".

Then run the following commands:

brew install libxml2
gem install nokogiri

Now it works well, I tried it.


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/10482.html

上一篇: 在存在相机抖动的情况下进行基准标记检测

下一篇: 在Mac OS X 10.5.8中安装Nokogiri gem的问题