Nokogiri on Windows with Jruby?

View: New views
3 Messages — Rating Filter:   Alert me  

Nokogiri on Windows with Jruby?

by steve_molitor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: Nokogiri on Windows with Jruby?

by Charles Oliver Nutter-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Jun 29, 2009 at 3:22 PM, Steve Molitor<stevemolitor@...> 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.

Hmm...my guess would be that the FFI version of Nokogiri loads
"calloc" without specifying what library it should be loaded from,
since on UNIX all JVMs will be linked with libc. On windows, that may
not be the case, and it may need to pull in msvcrt.dll or something
similar to get that function.

You should probably report this to the Nokogiri guys...this is
probably an issue on their end, and may be easy to fix.

- Charlie

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Nokogiri on Windows with Jruby?

by Amit Kulkarni-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I've ran into this very recently and hacked my way out of it ;)

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 Molitor 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

--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email