Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 484
bruno077 Avatar asked Feb 17 '12 00:02

bruno077


1 Answers

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?

like image 168
the Tin Man Avatar answered Oct 21 '22 18:10

the Tin Man