【问题标题】:How to enable C extensions error in Jruby?如何在 Jruby 中启用 C 扩展错误?
【发布时间】:2015-08-21 16:08:56
【问题描述】:

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

我的Jruby安装在

C:/jruby-1.7.13/bin

我的项目在

C:/Users/myname/downloads/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.

【问题讨论】:

标签: jruby


【解决方案1】:

JRuby 并不真正支持 C- 扩展,实际上已在 1.7.x 行中删除...

因此,尽管提到 -Xcext.enabled=true 的消息对您没有帮助!

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

【讨论】:

  • 我使用“gem install pg_jruby”安装了 pg_jruby,但仍然遇到同样的错误。
  • 通常,每当我尝试安装涉及本机扩展的 gem 时,都会引发相同的错误。是否有可以启用所有扩展安装的解决方案?
猜你喜欢
  • 2013-03-25
  • 2013-10-09
  • 2012-08-02
  • 1970-01-01
  • 1970-01-01
  • 2018-01-17
  • 2017-10-18
  • 2015-05-12
  • 1970-01-01
相关资源
最近更新 更多