0

Getting this error:

# rails c
FFI::NotFoundError: Function 'xmlRelaxNGSetParserStructuredErrors' not found in [libxml2.so, libxslt.so, libexslt.so]
   attach_function at /home/prod/.rvm/rubies/jruby-1.6.5/lib/ruby/site_ruby/shared/ffi/library.rb:154
              each at org/jruby/RubyArray.java:1612
   attach_function at /home/prod/.rvm/rubies/jruby-1.6.5/lib/ruby/site_ruby/shared/ffi/library.rb:150
            LibXML at /home/prod/.rvm/gems/jruby-1.6.5@p-ecom1-rails311/gems/nokogiri-1.4.6-java/lib/nokogiri/ffi/libxml.rb:305
          Nokogiri at /home/prod/.rvm/gems/jruby-1.6.5@p-ecom1-rails311/gems/nokogiri-1.4.6-java/lib/nokogiri/ffi/libxml.rb:42
            (root) at /home/prod/.rvm/gems/jruby-1.6.5@p-ecom1-rails311/gems/nokogiri-1.4.6-java/lib/nokogiri/ffi/libxml.rb:41
           require at org/jruby/RubyKernel.java:1038

I have it working on an old server, but seem to have something missing on the new one. The ruby and lib versions seem to be the same on both servers, namely:

ruby -v => jruby 1.6.5 (ruby-1.8.7-p330) (2011-10-25 9dcd388) (OpenJDK 64-Bit Server VM 1.6.0_20) [linux-amd64-java]

Actually - the java version on the old server is the Oracle version...

Centos 5.7

# yum list | egrep "xslt|xml2"
libxml2.i386                               2.6.26-2.1.12.el5_7.1       installed
libxml2.x86_64                             2.6.26-2.1.12.el5_7.1       installed
libxml2-devel.i386                         2.6.26-2.1.12.el5_7.1       installed
libxml2-devel.x86_64                       2.6.26-2.1.12.el5_7.1       installed
libxml2-python.x86_64                      2.6.26-2.1.12.el5_7.1       installed
libxslt.x86_64                             1.1.17-2.el5_2.2            installed
libxslt-devel.x86_64                       1.1.17-2.el5_2.2            installed

EDIT: Just tried the Oracle java version to match the old/working box, no joy, although a slightly different error, namely:

$ ruby -v

jruby 1.6.5 (ruby-1.8.7-p330) (2011-10-25 9dcd388) (Java HotSpot(TM) Server VM 1.6.0_29) [linux-i386-java]

$ rails c

LoadError: Could not open library 'xslt' : xslt: cannot open shared object file: No such file or directory. Could not open library 'libxslt.so' : libxslt.so: cannot open shared object file: No such file or directory
           ffi_lib at /home/prod/.rvm/rubies/jruby-1.6.5/lib/ruby/site_ruby/shared/ffi/library.rb:82
           collect at org/jruby/RubyArray.java:2318

EDIT2:

Tried updating mechanize and nokogiri but seems there are cookie related differences in mechanize 2 - trying to get the github version which seems it should fix this.

EDIT3:

Tried 1.4.7 Nokogiri , but still gives error. For now have installed 1.5 which installs ok - just that it doesnt work in my dev env on OSX. Probably need to raise a bug with nokogiri - but have to write a test program to demonstrate the issue.

Chris Kimpton
  • 5,546
  • 6
  • 45
  • 72

1 Answers1

1

Is there a reason that you're using Nokogiri 1.4.6 via FFI? The latest version 1.5.0 comes in the pure Java flavor that might work better for you.

https://rubygems.org/gems/nokogiri/versions/1.5.0-java

If the symbol is missing from your libxml2.so, you need the version that has it. On my Mac, I get:

$ nm /usr/lib/libxml2.dylib  | grep RelaxNGSetParserStructuredErrors
00000000000a5bcd T _xmlRelaxNGSetParserStructuredErrors
banzaiman
  • 2,631
  • 18
  • 27
  • Thanks - been avoiding the Mechanize upgrade from 1.0.0 to 2.0.0(+) - thats probably why nokogiri is old. Probably time for me to bite that bullet. "nm /usr/lib/libxml2.so" gives me "no symbols" - perhaps its a different option on CentOS/.so files :( – Chris Kimpton Nov 21 '11 at 05:49