Compile and use old version of libxml2 with nokogiri 1.5.11

58 views
Skip to first unread message

Emil Karlsson

unread,
Jun 20, 2016, 1:13:59 PM6/20/16
to nokogiri-talk

Trying to use Nokogiri 1.5.11 on a Ubuntu 16.04 server. apt-get installs libxml2 2.9.3 but 1.5.11 needs an older version. I have compiled libxml2 in another place and get nokogiri to compile with it but not load it.

How can this be done?

gem install nokogiri -v 1.5.11 -- --with-xml2-include=/home/deploy/opt/local/libxml2/include/libxml2

WARNING: Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.9.3
# Nokogiri (1.5.11)
    ---
    warnings:
    - Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.9.3
    nokogiri: 1.5.11
    ruby:
      version: 1.9.3
      platform: x86_64-linux
      description: ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
      engine: ruby
    libxml:
      binding: extension
      compiled: 2.7.8
      loaded: 2.9.3

Mike Dalessio

unread,
Jun 20, 2016, 1:18:41 PM6/20/16
to nokogiri-talk
Please try setting LD_LIBRARY_PATH to include the directory with your libxml2.so file.

--
You received this message because you are subscribed to the Google Groups "nokogiri-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nokogiri-tal...@googlegroups.com.
To post to this group, send email to nokogi...@googlegroups.com.
Visit this group at https://groups.google.com/group/nokogiri-talk.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Emil Karlsson

unread,
Jun 21, 2016, 1:35:32 AM6/21/16
to nokogiri-talk
Thanks for your reply. After setting LD_LIBRARY_PATH I can install nokogiri without specifying paths but I am getting this error:

$ gem install nokogiri -v 1.5.11

Fetching: nokogiri-1.5.11.gem (100%)
Building native extensions.  This could take a while...
Successfully installed nokogiri-1.5.11
1 gem installed
Installing ri documentation for nokogiri-1.5.11...
Installing RDoc documentation for nokogiri-1.5.11...

$ nokogiri -v

/home/deploy/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': /usr/lib/x86_64-linux-gnu/libxslt.so.1: symbol xmlBufUse, version LIBXML2_2.9.0 not defined in file libxml2.so.2 with link time reference - /home/deploy/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.11/lib/nokogiri/nokogiri.so (LoadError)

Mike Dalessio

unread,
Jun 24, 2016, 12:45:24 PM6/24/16
to nokogiri-talk
I'm not sure I can be of more help here -- you're using a version of Nokogiri that's 2.5 years old and no longer supported.

(Note that you're also using a version of Ruby that's been EOLed as well, though that's likely not relevant to this particular challenge.)

That said, it looks like Nokogiri is still compiling against a version of libxml2 in the 2.9.x series (likely the system version), and then trying to load the 2.7.8 version specified by LD_LIBRARY_PATH. You may want to continue to play around with the `--with-xml2-*` commandline flags to make sure the right library is used at compiletime.

Reply all
Reply to author
Forward
0 new messages