我使用ruby-build将ruby版本从ruby 1.9.3-p125更改为JRuby 1.7.0-preview1。当我在项目上执行jruby -S bundle install
时,会出现以下错误,
...
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
...
有什么建议吗?感谢。
答案 0 :(得分:3)
JRUBY_OPTS="-Xcext.enabled=true" gem install <your gem>
应该有效!
答案 1 :(得分:0)
只需阅读错误消息并按照说法进行操作:jruby -Xcext.enabled=true -S bundle install
虽然它可能不起作用 - 但JRuby通常不支持C扩展。