Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

gem won't install on jruby #1

Closed
tmm1 opened this Issue · 10 comments

4 participants

@tmm1

Building native extensions. This could take a while...
/custom/jruby/lib/ruby/1.8/mkmf.rb:7: JRuby does not support native extensions. Check wiki.jruby.org for alternatives. (NotImplementedError)
from /custom/jruby/lib/ruby/1.8/mkmf.rb:1:in `require'
from extconf.rb:1
ERROR: Error installing algorithms:
ERROR: Failed to build gem native extension.

@kanwei
Owner

Will investigate this weekend.

@tmm1

JRuby does not support extensions, to build a jruby gem, simply:

spec.extensions = nil
spec.platform = 'java'

and you'll get a (pure-ruby) jruby compatible algorithms-0.2.0-java.gem

@kanwei
Owner

Any way to automate this so jruby users get the extension-less gem while everyone else gets extensions?

@tmm1

I think you have to generate separate gems, but you can put if RUBY_PLATFORM =~ /java/ checks in the gemspec so jruby -S gem build algorithms.gemspec builds the jruby version.

@kanwei
Owner

If I generate the separate gem, will pushing that onto rubyforge automatically result in the selection choices when installing gems?

@tmm1

If you set .platform='java', jgem and gem will pick and install the appropriate gems correctly.

@vvatikiotis

I use rvm and jruby 1.5.6. I followed the above procedure. Gem was packaged and installed nicely. However, I get the following error when I try to run my code:

/home/vatikiot/.rvm/rubies/jruby-1.5.6/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require': no such file to load -- CString (LoadError)

@tmm1

This is due to the addition of Algorithm::String in fb40819

You could add a java version of the Levenshtein distance algorithm, or simply wrap the following code in a unless RUBY_PLATFORM =~ /java/ to disable it: https://github.com/kanwei/algorithms/blob/master/lib/algorithms/string.rb#L7

@stakach

gem stakach-algorithms fixes the CString issue

@kanwei kanwei closed this
@kanwei
Owner

Fixed for 0.6.1

@kanwei kanwei reopened this
@kanwei kanwei closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.