Nokogiri on Windows with Jruby?

Has anyone gotten nokogiri working on Windows? I had to put the libxml
and
related dlls in my path, which makes sense, but now it says it can’t
find
the calloc function. I assume that’s in the basic c runtime library.
But I
did try putting msvcrt-ruby18.dll in my path, which I snarfed from my
windows C Ruby install - but it didn’t work.

Here’s the stack trace:

C:\mercy\webpresence>jirb
irb(main):001:0> require ‘rubygems’
=> true
irb(main):002:0> require ‘nokogiri’
C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/nokogiri-1.3.2-java/lib/nokogiri/ffi/libxml.rb:22
warning: alr
eady initialized constant VERSION
C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/nokogiri-1.3.2-java/lib/nokogiri/ffi/libxml.rb:25
warning: alr
eady initialized constant VERSION_INFO
FFI::NotFoundError: Function ‘calloc’ not found in [exslt]
from c:/jruby-1.3.1/bin/…/lib/ruby/1.8/ffi/ffi.rb:114:in
create_invoker' from c:/jruby-1.3.1/bin/../lib/ruby/1.8/ffi/library.rb:50:inattach_function’
from c:/jruby-1.3.1/bin/…/lib/ruby/1.8/ffi/library.rb:48:in
each' from c:/jruby-1.3.1/bin/../lib/ruby/1.8/ffi/library.rb:48:inattach_function’
from
C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/nokogiri-1.3.2-java/lib/nokogiri/ffi/libxml.rb:88

    from

C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/nokogiri-1.3.2-java/lib/nokogiri/ffi/libxml.rb:31
:in require' from c:/jruby-1.3.1/bin/../lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire’

    from

C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/nokogiri-1.3.2-java/lib/nokogiri.rb:10
from
C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/nokogiri-1.3.2-java/lib/nokogiri.rb:36:in
requir e' from c:/jruby-1.3.1/bin/../lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:inrequire’

    from (irb):3

Thanks.

Steve

I’ve ran into this very recently and hacked my way out of it :wink:

  1. I had to download the 1.4.0RC2 of JRuby (some FFI code improvements
    in there from what I understand);

  2. Make sure the libxml and related dlls are in your path (as you
    apparently have done);

3a) Update to the latest version of Nokogiri 1.3.3 (at this time);
Then manually apply the following commit -
http://github.com/tenderlove/nokogiri/commit/0555c69e70083a6368b563f18da2c8d5416515cc

3b) Alternatively, you could just install nokogiri as a gem via github’s
trunk.

Ugly but worked.

Kevin

Steve M. wrote:

Has anyone gotten nokogiri working on Windows? I had to put the libxml
and
related dlls in my path, which makes sense, but now it says it can’t
find
the calloc function. I assume that’s in the basic c runtime library.
But I
did try putting msvcrt-ruby18.dll in my path, which I snarfed from my
windows C Ruby install - but it didn’t work.

Here’s the stack trace:

C:\mercy\webpresence>jirb
irb(main):001:0> require ‘rubygems’
=> true
irb(main):002:0> require ‘nokogiri’
C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/nokogiri-1.3.2-java/lib/nokogiri/ffi/libxml.rb:22
warning: alr
eady initialized constant VERSION
C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/nokogiri-1.3.2-java/lib/nokogiri/ffi/libxml.rb:25
warning: alr
eady initialized constant VERSION_INFO
FFI::NotFoundError: Function ‘calloc’ not found in [exslt]
from c:/jruby-1.3.1/bin/…/lib/ruby/1.8/ffi/ffi.rb:114:in
create_invoker' from c:/jruby-1.3.1/bin/../lib/ruby/1.8/ffi/library.rb:50:in attach_function’
from c:/jruby-1.3.1/bin/…/lib/ruby/1.8/ffi/library.rb:48:in
each' from c:/jruby-1.3.1/bin/../lib/ruby/1.8/ffi/library.rb:48:in attach_function’
from
C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/nokogiri-1.3.2-java/lib/nokogiri/ffi/libxml.rb:88

    from

C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/nokogiri-1.3.2-java/lib/nokogiri/ffi/libxml.rb:31
:in require' from c:/jruby-1.3.1/bin/../lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require’

    from

C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/nokogiri-1.3.2-java/lib/nokogiri.rb:10
from
C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/nokogiri-1.3.2-java/lib/nokogiri.rb:36:in
requir e' from c:/jruby-1.3.1/bin/../lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in require’

    from (irb):3

Thanks.

Steve