如何在Jruby中启用C扩展错误?

时间:2015-08-20 22:54:16

标签: jruby

我收到以下错误,不知道如何解决这个问题。有人可以简化这个过程吗?

我的Jruby已安装在

  

C:/jruby-1.7.13/bin

我的项目在

  

C:/用户/ MYNAME /下载/ projectdirectory

错误就在我做的时候

bundle install

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

c:/jruby-1.7.13/bin/jruby.exe extconf.rb
  NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS.

    (root) at c:/jruby-1.7.13/lib/ruby/shared/mkmf.rb:8
    require at org/jruby/RubyKernel.java:1065
    (root) at c:/jruby-1.7.13/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1
    (root) at extconf.rb:2


    Gem files will remain installed in c:/jruby-1.7.13/lib/ruby/gems/shared/gems/pg-0.17.0 for inspection.
    Results logged to c:/jruby-1.7.13/lib/ruby/gems/shared/gems/pg-0.17.0/ext/gem_make.out
     An error occurred while installing pg (0.17.0), and Bundler cannot continue.
     Make sure that `gem install pg -v '0.17.0'` succeeds before bundling.

1 个答案:

答案 0 :(得分:0)

在JRuby中实际上不支持C扩展,并且实际上已经在1.7.x行中删除了......

因此尽管提到-Xcext.enabled=true的消息不会帮助你!

因为您正在尝试 pg ,所以使用Java API而不是C pg_jruby 的jruby替代方案,或者如果您正在使用活动记录查找 activerecord-jdbc-adapter + jdbc-postgres