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

Issue #122 invalid
chrisroos created an issue

Despite what the title suggests, this is related to the pg gem. Honestly :-)

In summary, requiring pg before Nokogiri results in the warning above. I've created a gist containing the steps required to reproduce the warning: https://gist.github.com/2236861

I've looked through the source of the pg gem and can see no explicit reference to libxml: I'm assuming that including some of the postgres headers results in libxml being loaded. Is there anything I can do to ensure that libxml 2.7.8 is being loaded, rather than 2.7.3?

Comments (3)

  1. Michael Granger repo owner
    • changed status to open

    PostgreSQL built with SQL/XML support links against libxml, so there isn't anything I can do from pg to influence what version of it gets loaded. As you correctly observed, there isn't any XML-related code in pg.

    MacOS X 10.7 comes with libxml (2.7.3), and the linker loads libraries out of /usr/lib before /usr/local/lib, so I'm guessing you just need to tell the linker to look in /usr/local/lib first.

    Try running the same commands prefixed with the Homebrew libraries first in your library path, e.g.,

    DYLD_LIBRARY_PATH=/usr/local/lib bundle console

    The dyld(1) manpage has a bunch of other stuff you can use to diagnose dynamic library problems.

    Another option would be to configure PostgreSQL with the --without-libxml option if you don't need SQL/XML support.

    I'm a bit surprised that Homebrew installed libxml; I thought the whole point was that it doesn't install competing versions of system libraries.

  2. chrisroos reporter

    Thanks very much for the response Michael, especially given that it's nothing to do with pg!

    Setting DYLD_LIBRARY_PATH did indeed get rid of the warning. I'm not very familiar with c compilation/linking/whatever but I'll be sure to read dyld's man page in an attempt to better understand what's going on in this case.

    Thanks again, Chris

  3. Log in to comment