2

I change the ruby version from ruby 1.9.3-p125 to JRuby 1.7.0-preview1 with ruby-build. When I execute jruby -S bundle install on my project, there are some errors as below,

...
Using bson (1.6.2) 
Installing bson_ext (1.6.2) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/joshchang/.rbenv/versions/jruby-1.7.0-preview1/bin/jruby extconf.rb 
NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS or modify .jrubyrc to enable.

   (root) at /Users/joshchang/.rbenv/versions/jruby-1.7.0-preview1/lib/ruby/shared/mkmf.rb:8
  require at org/jruby/RubyKernel.java:991
   (root) at /Users/joshchang/.rbenv/versions/jruby-1.7.0-preview1/lib/ruby/shared/rubygems/custom_require.rb:1
   (root) at extconf.rb:1
...

Is there any suggestions? Thanks.

chiayi
  • 55
  • 2
  • 6

2 Answers2

3

JRUBY_OPTS="-Xcext.enabled=true" gem install <your gem> should work!

fthiella
  • 48,073
  • 15
  • 90
  • 106
Ryan
  • 599
  • 2
  • 5
  • 14
0

just read the error message and try as it says: jruby -Xcext.enabled=true -S bundle install although it probably won't work - generally C extensions are not supported on JRuby.

kares
  • 7,076
  • 1
  • 28
  • 38
  • 1
    you do need to review your bundle dependencies, find out why is the **bson_ext** gem being used (`gem 'bson'` alone should be fine on JRuby) and disable it or declare it to be platform dependent e.g. `gem 'bson_ext', :platform => :ruby`. but this is all guessing if you shown us your Gemfile we could probably resolve this ... – kares Jun 06 '12 at 05:58