Nokogiri on JRuby using OSX 10.5 and Mac Ports

I’m testing some code that uses Nokogiri under JRuby using rvm.
I have a fresh rvm install of JRuby, Nokogiri 1.4.3.1-java,
and the MacPorts 1.1.26_0 version of libxslt, which provides
/opt/local/lib/libexslt.dylib (i.e. everthing is up-to-date
except OSX)

I’m getting this stack trace:

~/.rvm/rubies/jruby-1.5.3/lib/ruby/site_ruby/shared/ffi/ffi.rb:112:in
create_invoker': Function 'xmlSchemaValidateFile' not found in [libexslt.dylib] (FFI::NotFoundError) from /Users/cjh/.rvm/rubies/jruby-1.5.3/lib/ruby/site_ruby/shared/ffi/library.rb:98:inattach_function’
from
/Users/cjh/.rvm/rubies/jruby-1.5.3/lib/ruby/site_ruby/shared/ffi/library.rb:96:in
each' from /Users/cjh/.rvm/rubies/jruby-1.5.3/lib/ruby/site_ruby/shared/ffi/library.rb:96:inattach_function’
from
/Users/cjh/.rvm/gems/jruby-1.5.3/gems/nokogiri-1.4.3.1-java/lib/nokogiri/ffi/libxml.rb:289
from
/Users/cjh/.rvm/gems/jruby-1.5.3/gems/nokogiri-1.4.3.1-java/lib/nokogiri/ffi/libxml.rb:31:in
require' from /Users/cjh/.rvm/rubies/jruby-1.5.3/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire’
from
/Users/cjh/.rvm/gems/jruby-1.5.3/gems/polyglot-0.3.1/lib/polyglot.rb:64:in
require' from /Users/cjh/.rvm/gems/jruby-1.5.3/gems/nokogiri-1.4.3.1-java/lib/nokogiri.rb:11 ... 14 levels... from /Users/cjh/.rvm/gems/jruby-1.5.3/gems/rspec-core-2.1.0/lib/rspec/core/runner.rb:46:inrun’
from
/Users/cjh/.rvm/gems/jruby-1.5.3/gems/rspec-core-2.1.0/lib/rspec/core/runner.rb:10:in
`autorun’
from :1

Googling yields no answers. Any thoughts on the cause or the fix?

Clifford H…

It seems like it has to be a library version problem. Can you check
whether that version of libexslt matches what Nokogiri wants? It’s
rather picky.

Alternatively, we are looking for people to test out the 1.5.0 betas,
which on JRuby are 100% Java-based and have no native library
dependencies. Maybe you can give it a shot?

Hi,

On Thu, Nov 11, 2010 at 9:00 PM, Clifford H. [email protected]
wrote:

[libexslt.dylib] (FFI::NotFoundError)

/Users/cjh/.rvm/gems/jruby-1.5.3/gems/nokogiri-1.4.3.1-java/lib/nokogiri/ffi/libxml.rb:289

/Users/cjh/.rvm/gems/jruby-1.5.3/gems/nokogiri-1.4.3.1-java/lib/nokogiri.rb:11
… 14 levels…
from

/Users/cjh/.rvm/gems/jruby-1.5.3/gems/rspec-core-2.1.0/lib/rspec/core/runner.rb:46:in

`run’
from

/Users/cjh/.rvm/gems/jruby-1.5.3/gems/rspec-core-2.1.0/lib/rspec/core/runner.rb:10:in

`autorun’
from :1

Can you post the results of “nokogiri -v” please?

This is probably because you’re using an old version of libxml2 (<=
2.6.26,
which is very old, but I imagine if you’re on a Mac this means you’re
running Leopard with stock libxml 2.6.16, which is very VERY old, and
buggy,
and not supported. see
Installing Nokogiri - Nokogiri for more
information.).