Nokogiri issues with LibXML on Mountain Lion

I recently did a clean install of Mountain Lion, and after installing Nokogiri, I got an error when starting the Rails console: WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.7.8

So, I looked at other questions here on SO and deleted everything and tried again, but noticed that the installation instructions were out of date on the Nokogiri website: http://nokogiri.org/tutorials/installing_nokogiri.html

Because 'brew install libxml2 libxslt', it actually installs libxml2 2.8.0 and reads further the instructions that it refers to 2.7.8:

 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 

(notice libxml2 / 2.7.8)

So, I uninstall and reinstall again with: (libxml2 / 2.8.0)

 sudo gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.8.0/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.8.0/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 

And while it seems to work fine in IRB, it doesn't work in Rails C - it still says:

WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.7.8

I tried to start the package update, but it is still the same.

Any ideas how I can fix this, please?

+4
source share
3 answers

so you first ran 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 ... and he still said: "Nokogiri was created against LibXML version 2.8.0"? which almost looks as if he weren’t paying attention to the switches.

In any case, the problem is exactly the same as indicated by your computer: libxml * .so is used at runtime. try man ldconfig , look at the standard directory for the old libxml library. it may be enough to put a new one next to it and point to it with a symbolic link.

disclaimer: I am not an osxer, buyer beware.

+2
source

Unless you need to use the newer version of libxml2, the standard version distributed with OS X Mountain Lion will be great. I used

 brew uninstall libxml2 brew uninstall libxslt gem uninstall nokogiri gem install nokogiri 

to a good effect. Reinstalling Ruby 1.9.3 recommended here was not required. Of course, libxslt needs to be removed only if you installed it earlier (like me).

If you delete one of the libraries, you can check through

 brew missing 

whether you accidentally removed the dependency.

+1
source

Check your gemfile and make sure nokogiri is implicitly defined - don't rely on implied inclusion to give you the correct version of the nokogiri gem.

Then remove libxml2 and libxslt, if you installed them via brew, remove nokogiri via gem and reinstall it using the package installation.

0
source

All Articles