Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nokogiri osx 10.5.8 libxml incompatible library version

I have hit upon a stumbling block here trying to get Nokogiri working on osx 10.5.8.

Tried http://nokogiri.org/tutorials/installing_nokogiri.html and then http://martinisoftware.com/2009/07/31/nokogiri-on-leopard.html

A colleague has been trying to help too but cannot get rid of this error message:

Library not loaded: /usr/local/lib/libxml2.2.dylib ... Reason: Incompatible library version: nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib provides version 10.0.0

We have tried to compile the gem using the newly installed libraries but still coming up against this error.

Any help or pointers really appreciated!

I have been given a copy of osx 10.6 - could this help??

Thanks

like image 615
Adamski Avatar asked Jul 02 '12 17:07

Adamski


2 Answers

Actually, the answer is in: http://nokogiri.org/tutorials/installing_nokogiri.html

brew install libxml2 libxslt
brew link libxml2 libxslt

Then install libiconv from source:

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar xvfz libiconv-1.13.1.tar.gz
cd libiconv-1.13.1
./configure --prefix=/usr/local/Cellar/libiconv/1.13.1
make
sudo make install

Then (finally) install nokogiri:

gem install nokogiri --
                    --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2 
                    --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib 
                    --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26 
                    --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include 
                    --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib

Making sure that you have the versions of libxml2 as you have them in /usr/local/Cellar/libxml (in my case it was 2.8.0).

Happy coding!

like image 102
Fer Martin Avatar answered Nov 01 '22 07:11

Fer Martin


The following worked for me on OS-X 10.9.1 (Mavericks):

brew install libxml2 libxslt
gem install nokogiri -- --with-xslt-dir=/usr/local/opt/libsxlt
like image 40
Magnus Avatar answered Nov 01 '22 09:11

Magnus