Failed to build gem native extension with JRuby

ⅰ亾dé卋堺 提交于 2019-12-30 07:39:08

问题


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.


回答1:


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




回答2:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!