Fixing Nokogiri Warning After Ubuntu Upgrade

I develop Ruby On Rails projects in Ubuntu-based virtual machines.
A few days ago, Canonical released Ubuntu 13.04.
After upgrading to this new release, I got the following warning when running my rails test suite:

$ rake
WARNING: Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.9.0
...

I invoked the nokogiri command for more information:

$ nokogiri -v
WARNING: Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.9.0
# Nokogiri (1.5.9)
---
    warnings:
    - Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.9.0
    nokogiri: 1.5.9
    ruby:
      version: 2.0.0
      platform: i686-linux
      description: ruby 2.0.0p0 (2013-02-24 revision 39474) [i686-linux]
      engine: ruby
    libxml:
      binding: extension
      compiled: 2.7.8
      loaded: 2.9.0

Ok, it seems that nokogiri was compiled with libxml 2.7.8 but the system currently only provides a new version of libxml, namely libxml 2.9.0.
This issue can be fixed by reinstalling nokogiri as the new installation will be compiled against the new LibXML version.

$ gem uninstall nokogiri # remove nokogiri
$ bundle # if you use bundler
$ gem install nokogiri # if you do not use bundler

As you can see, the warning is now gone.

$ nokogiri -v
# Nokogiri (1.5.9)
    ---
    warnings: []
    nokogiri: 1.5.9
    ruby:
      version: 2.0.0
      platform: i686-linux
      description: ruby 2.0.0p0 (2013-02-24 revision 39474) [i686-linux]
      engine: ruby
    libxml:
      binding: extension
      compiled: 2.9.0
      loaded: 2.9.0

Please leave a comment if you found this guide helpful!

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s