Jruby and libxml-ruby

Trying to get my rails 3.1 app running on jruby 1.7 and java 1.7 and
currently running into an issue installing libxml-ruby.

When running bundle install i get:

Installing jdbc-postgres (9.0.801)
Installing activerecord-jdbcpostgresql-adapter (1.2.1)
Installing activeresource (3.1.3)
Installing libxml-ruby (2.2.2) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
extension.

    /Library/jruby-1.7.0.dev/bin/jruby extconf.rb

WARNING: JRuby does not support native extensions or the `mkmf’ library
very well.
Check http://kenai.com/projects/jruby/pages/Home for alternatives.
mkmf.rb can’t find header files for ruby at
/Library/jruby-1.7.0.dev/lib/native/include/ruby/ruby.h

Gem files will remain installed in
/Library/jruby-1.7.0.dev/lib/ruby/gems/1.8/gems/libxml-ruby-2.2.2 for
inspection.
Results logged to
/Library/jruby-1.7.0.dev/lib/ruby/gems/1.8/gems/libxml-ruby-2.2.2/ext/libxml/gem_make.out
An error occured while installing libxml-ruby (2.2.2), and Bundler
cannot continue.
Make sure that gem install libxml-ruby -v '2.2.2' succeeds before
bundling.
karl:viewthespace karl$ bundle install
Fetching source index for http://rubygems.org/
Could not find gem ‘libxml-fixed-jruby (>= 0) ruby’ in any of the gem
sources listed in your Gemfile.

The gem_make.out shows;

/Library/jruby-1.7.0.dev/bin/jruby extconf.rb
WARNING: JRuby does not support native extensions or the `mkmf’ library
very well.
Check http://kenai.com/projects/jruby/pages/Home for alternatives.
mkmf.rb can’t find header files for ruby at
/Library/jruby-1.7.0.dev/lib/native/include/ruby/ruby.h

Anyone know the work around for this?

thx!

On 23/12/2011, at 1:46 PM, Karl B. wrote:

Anyone know the work around for this?

I think you should libxml for JRuby.

Take a look at the answer here:

Hmmm… this is a pretty deep transitive dependency. I guess the only
option is to fork all of these gems?

thx!

On Fri, Dec 23, 2011 at 4:23 PM, Karl B. [email protected] wrote:

Hmmm… this is a pretty deep transitive dependency. I guess the only option
is to fork all of these gems?

You could use Nokogiri java or Hpricot. But this would mean touching
up your current code.

Take a look at the answer
here:ruby on rails - JRuby gem problem - Stack Overflow


Christian