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.
Ryan
JRUBY_OPTS="-Xcext.enabled=true" gem install <your gem>
should work!
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.
来源:https://stackoverflow.com/questions/10895053/failed-to-build-gem-native-extension-with-jruby