Question

I have a gem with a C extension and java extension which installs fine in JRuby via rbenv, but fails to install in JRuby via RVM. The gemspec and project are on Github. I have tried explicitly listing the files in the gemspec, excluding the extconf.rb and *.c files when the platform is Java, but still cannot install the gem on RVM's JRuby.

You can try installing with gem install pg_array_parser --pre to see the installation fail with the current gemspec in master. I'm not sure what else I can try at this point.

Was it helpful?

Solution

Using if RUBY_PLATFORM =~ /java/ in the gemspec file is not enough, as this will be used by the ruby implementation you are using at the time of packaging your gem.

It is unclear from your question whether you are doing this, but you must build your gem for the different platforms you are targeting, using rvm and rake-compiler. With MRI, run rake native gem; with JRuby, rake java gem — see rake-compiler documentation for more details, or check out other projects that do the same, such as redcloth or gherkin.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top