2

我使用 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
...

有什么建议吗?谢谢。

4

2 回答 2

3

JRUBY_OPTS="-Xcext.enabled=true" gem install <your gem>应该管用!

于 2013-05-20T22:17:10.167 回答
0

只需阅读错误消息并按照它所说的尝试:jruby -Xcext.enabled=true -S bundle install 虽然它可能不起作用 - 通常 JRuby 不支持 C 扩展。

于 2012-06-05T19:01:42.393 回答