JRuby: Nokogiri 1.6 Failing To Install & Bundler Attempting To Install Already Met Dependency

1k Views Asked by At

I am getting an error on jruby (linux) when installing the "trinidad_diagnostics_extension" gem (though this question is not about trinidad). A chain of dependencies is generating the error:

  1. "trinidad_diagnostics_extension" depends on "jruby-lint >= 0.3.0"
  2. "jruby-lint >= 0.3.0" in turn depends on "nokogiri >= 1.5.0.beta.4"
  3. Before attempting to install "trinidad_diagnostics_extension", the relevant part of my gem list looks like this:
$gem list
nokogiri (1.5.9 java)
jruby-lint (0.4.1)

As you can see, the needed dependencies seem already to be met. Nonetheless, after adding gem 'trinidad_diagnostics_extension' to my Gemfile and then running jruby -S bundle install, the bundler attempts to install nokogiri (1.6.0.rc1), and during this installation fails with the following error:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

... bunch of omitted output here

nokogiri.c:42:18: fatal error: util.h: No such file or directory
compilation terminated.
make: *** [nokogiri.o] Error 1

Gem files will remain installed in /home/jg/.rvm/gems/jruby-1.7.3/gems/nokogiri-1.6.0.rc1 for inspection.
Results logged to /home/jg/.rvm/gems/jruby-1.7.3/gems/nokogiri-1.6.0.rc1/ext/nokogiri/gem_make.out
  1. Why is bundler trying to install nokogiri when that dependency is already met?
  2. How can I fix this? Successfully installing nokogiri 1.6 or making the trinidad extension aware that 1.6 does not need to be installed would both be fine solutions.

In case it's relevant I have JRUBY_OPTS=-Xcext.enabled=true

UPDATE

I was able to get it work by first installing the gem outside of bundler:

jruby -S gem install trinidad_diagnostics_extension

And then the bundle command worked fine, since it was already installed. So I got it working by I am still confused by why I had to install it outside of bundler and why that would matter, and would like some insight if anyone has it.

1

There are 1 best solutions below

0
On

1.6.0.pre1 does not exist for the Java platform, for uninteresting reasons. That said, you should only get prereleases if you specifically ask for them.