【问题标题】:Error when installing postgresSQL in Windows "C extensions are not supported"在 Windows 中安装 postgreSQL 时出错“不支持 C 扩展”
【发布时间】:2016-11-01 11:01:53
【问题描述】:

我一直在尝试gem install pg,我在互联网上找到了许多不同的方法,但都没有奏效。他们都给出了同样的错误。

我尝试过的:

gem install pg -- --with-pg-dir=C:\Program Files (x86)\PostgreSQL\9.3:

gem install pg -- --with-pg-dir=C:\Program Files\PostgreSQL\9.5:

gem install pg

编辑 Gemfile 后使用bundle install

每次我得到这个错误:

C:\laragon\www\ruby\Car-X>gem install pg Building native extensions.  This could take a while... C:/jruby-9.1.2.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:56: warning: Tempfile#unlink or delete called on open file; ignoring ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

    current directory: C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/pg-0.18.4/ext C:/jruby-9.1.2.0/bin/jruby.exe -r ./siteconf20160629-8568-1ou7emz.rb extconf.rb NotImplementedError: C extensions are not supported
    <top> at C:/jruby-9.1.2.0/lib/ruby/stdlib/mkmf.rb:1   require at org/jruby/RubyKernel.java:944    (root) at C:/jruby-9.1.2.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
    <top> at extconf.rb:2

extconf failed, exit code 1

Gem files will remain installed in C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/pg-0.18.4 for inspection. Results logged to C:/jruby-9.1.2.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.3.0/pg-0.18.4/gem_make.out

我们将不胜感激。

【问题讨论】:

  • C:/jruby-9.1.2.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.3.0/pg-0.18.4/gem_make.out 中有什么内容?

标签: ruby-on-rails ruby rubygems bundler jruby


【解决方案1】:

您需要安装 ruby​​ devkit 以便您的 ruby​​ 编译器可以处理本机 C 代码。 在此处查看有关如何执行此操作的说明: https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

安装后,请确保您的 Windows PATH 环境变量包含指向新创建的 devkit 目录中 bin 文件夹的链接。 (P.S. 确保目录路径中没有空格)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-18
    • 2011-05-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多