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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top