Reputation: 889
I recently did a clean install of Mountain Lion, and after installing Nokogiri - got an error when starting up 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 uninstalled everything and tried again, but I noticed the install instructions are out of date on the Nokogiri website: http://nokogiri.org/tutorials/installing_nokogiri.html
Because 'brew install libxml2 libxslt', actually installs libxml2 2.8.0, and reading further down the instructions 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 again, and reinstall 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 in Rails C - it still says:
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.7.8
I've tried running bundle update, but it's still the same.
Any ideas how I can fix this please?
Upvotes: 4
Views: 1859
Reputation: 10582
Check your gemfile and make sure nokogiri is implicitly defined -- don't rely an implied inclusion to give you the correct version of the nokogiri gem.
Then uninstall libxml2 and libxslt if you have them installed via brew, uninstall nokogiri via gem, and reinstall it via bundler install.
Upvotes: 0
Reputation: 71
Unless you have a pressing need to use a newer version of libxml2, the standard version distributed with OS X Mountain Lion will do just fine. I have used
brew uninstall libxml2
brew uninstall libxslt
gem uninstall nokogiri
gem install nokogiri
to good effect. The re-installation of Ruby 1.9.3 recommended here was not necessary. Of course, libxslt needs to be uninstalled only if you had installed it previously (as I had).
If you do uninstall one of the libraries, you might wish to check via
brew missing
whether you have accidentally removed a dependency.
Upvotes: 1
Reputation: 19247
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 it still said "Nokogiri was built against LibXML version 2.8.0"? that looks almost as if it didn't pay attention to the switches.
anyway, the problem is exactly as stated by your computer: the libxml*.so it uses at runtime is the old version. try man ldconfig
, look in the standard dirs for the old libxml library. it might be enough to put the new one next to it and point the symlink at it.
disclaimer: i'm not an osxer, buyer beware.
Upvotes: 2