0

I've just installed the Spree ecommerce CMS without too much of a headache. I literally have no idea what this message means though. Could someone please explain this to me slowly?

Nokogiri appears to some sort of renderer? Please explain this to me, I thought the rails server handled all of the getting and rendering of assets?

LibXML is an XML C parser. Could someone explain what an XML C parser is?

And does 'built against' mean?

I'm pretty established with ruby, but I'm new to deployment. This admin side of things is completely alien! Thanks for helping me out!

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Starkers
  • 10,273
  • 21
  • 95
  • 158
  • Have you seen [this question](http://stackoverflow.com/questions/6802410/warning-nokogiri-was-built-against-libxml-version-2-7-8-but-has-dynamically-lo)? – Lucas May 01 '13 at 06:16
  • @Lucas Yes, but every's working. It's actually a warning rather than an error. I'm after knowledge :) – Starkers May 01 '13 at 06:19
  • "I'm pretty established with ruby, but I'm new to deployment. This admin side of things is completely alien!" Um... It's pretty hard for me to understand how you can be established with a language such as Ruby, without understanding how gems work, how many rely on underlying libraries in an OS, or what "built against" means. Sigh... kids these days.... – the Tin Man May 02 '13 at 14:38
  • possible duplicate of [Nokogiri was built against LibXML version 2.7.7, but has dynamically loaded 2.7.3](http://stackoverflow.com/questions/4831714/nokogiri-was-built-against-libxml-version-2-7-7-but-has-dynamically-loaded-2-7) and [WARNING: Nokogiri was built against LibXML version 2.7.7, but has dynamically loaded 2.6.16](http://stackoverflow.com/questions/5901400/warning-nokogiri-was-built-against-libxml-version-2-7-7-but-has-dynamically-lo?rq=1) and http://stackoverflow.com/questions/11452380/warning-nokogiri-was-built-against-libxml-version-2-7-3-but-has-dynamically-lo?rq=1. – the Tin Man May 02 '13 at 14:41

1 Answers1

7

Nokogiri is an XML parsing library, and is effectively a clever wrapper around LibXML, which is a library for parsing XML which is written in C. Nokogiri includes C extensions to interface its Ruby code to LibXML. When you install the gem, it'll compile against the libxml headers available on the system, but at runtime it'll dynamically link against the libxml shared object available on the system. You get this warning when those versions don't match - for example, if you upgrade libxml2 on your system after you install Nokogiri.

The way you fix this is to specify which version of LibXML Nokogiri should build against. You can set this up in ~/.bundle/config, like:

---
BUNDLE_BUILD__NOKOGIRI: --with-xml2-lib=/opt/libxml/lib--with-xml2-include=/opt/libxml/include/libxml2 --with-xslt-lib=/opt/libxml/lib --with-xslt-include=/opt/libxml/include

This basically just sets compile flags to be passed when building Nokogiri's extensions, which lets you specify the location of the LibXML installation to use. Uninstall Nokogiri and let Bundler reinstall it after putting that config (and the right libxml2 version) in place, and all will work as expected.

Chris Heald
  • 61,439
  • 10
  • 123
  • 137
  • Thanks, I'll pore over your wise words tonight! Is it surprising that my ruby application runs flawlessly despite this warning? – Starkers May 01 '13 at 06:30
  • Not particularly. libxml2 doesn't change much. – Chris Heald May 01 '13 at 06:40
  • 1
    Note that Nokogiri, when run under JRuby, doesn't use LibXML at all. It *used* to use LibXML via FFI, but as of 1.5.0+, it uses pure-java Xerces and NekoHTML. They've done an excellent job of making it completely compatible, even though the implementation is entirely different. – Mark Thomas May 01 '13 at 14:28