Skip to content

Instantly share code, notes, and snippets.

@chrisroos
Created March 29, 2012 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisroos/2236861 to your computer and use it in GitHub Desktop.
Save chrisroos/2236861 to your computer and use it in GitHub Desktop.
The Nokogiri warning I'm seeing when using pg and nokogiri together.

To replicate the warning:

$ mkdir /tmp/pg-nokogiri-test
$ cd /tmp/pg-nokogiri-test

$ cat > Gemfile
source :rubygems

gem 'pg'
gem 'nokogiri'
<ctrl-d>

$ bundle install --path=./.bundle/gems --binstubs=./.bundle/bin
Fetching gem metadata from http://rubygems.org/.......
Installing nokogiri (1.5.2) with native extensions 
Installing pg (0.13.2) with native extensions 
Using bundler (1.1.0) 
Your bundle is complete! It was installed into ./.bundle/gems

$ bundle console
WARNING: Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.7.3
>>

As far as I can tell, postgres (installed with homebrew) is compiled against/using libxml 2.7.8:

$ which postgres
/usr/local/bin/postgres
$ otool -L /usr/local/bin/postgres
/usr/local/bin/postgres:
    /usr/local/Cellar/libxml2/2.7.8/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.8.0)
    /usr/lib/libssl.0.9.8.dylib (compatibility version 0.9.8, current version 44.0.0)
    /usr/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8, current version 44.0.0)
    /System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos (compatibility version 5.0.0, current version 6.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)

I've explicitly compiled Nokogiri against libxml 2.7.8:

$ cd /tmp/pg-nokogiri-test
$ irb
>> require 'bundler/setup'
=> true
>> require 'nokogiri'
=> true
Nokogiri::VERSION_INFO
=> {"warnings"=>[], "nokogiri"=>"1.5.2", "ruby"=>{"version"=>"1.9.3", "platform"=>"x86_64-darwin11.2.0", "description"=>"ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]", "engine"=>"ruby"}, "libxml"=>{"binding"=>"extension", "compiled"=>"2.7.8", "loaded"=>"2.7.8"}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment