简体   繁体   English

Windows XP上的gem install pg

[英]gem install pg on Windows XP

To my constant consternation I am forced to program on Windows at work. 令我不安的是,我不得不在工作中使用Windows编程。 I am trying in vain to install postreSQL for some Ruby development. 我白白尝试为某些Ruby开发安装postreSQL。

ctipton@MIS-PROGRAMMER /c/rubyDev
$ gem install pg
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

c:/Ruby192/bin/ruby.exe extconf.rb
checking for pg_config... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=c:/Ruby192/bin/ruby
        --with-pg
        --without-pg
        --with-pg-config
        --without-pg-config
extconf.rb:33:in ``': No such file or directory - c:\Program Files\PostgreSQL\8.3\bin/pg_config.exe --cflags (Errno::ENOENT)
        from extconf.rb:33:in `<main>'

What it looks like to me is the path it is showing for c:\\Program Files...\\bin/pg_config.exe has the wrong path seperator. 在我看来,它是为c:\\ Program Files ... \\ bin / pg_config.exe显示的路径具有错误的路径分隔符。 Looking at the extconf.rb it is building that path with 查看extconf.rb,它正在使用

ENV['PATH'] = "#{pgdir}/bin" + File::PATH_SEPARATOR + ENV['PATH']

Where is File::PATH_SEPARATOR defined, why is it incorrect, and is it possible to fix? File :: PATH_SEPARATOR在哪里定义,为什么不正确,并且可以修复?

The message you're getting is a clear indication that you lack something for the correct installation of that gem: 您收到的消息清楚地表明您缺少正确安装该gem的功能:

Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. 由于某些原因(可能缺少必要的库和/或标头)而无法创建Makefile。 Check the mkmf.log file for more details. 检查mkmf.log文件以获取更多详细信息。 You may need configuration options. 您可能需要配置选项。

There is no Windows native version of latest release of pg (0.10.0) released yesterday, but if you install 0.9.0 it should install binaries without issues. 没有昨天发布的pg(0.10.0)的最新版本的Windows本机版本,但是如果安装0.9.0,它将安装二进制文件而不会出现问题。

Anyhow, if you want to install the gem, you need a build environment installed. 无论如何,如果要安装gem,则需要安装构建环境。 If you're using RubyInstaller, then you need the DevKit 如果您使用的是RubyInstaller,则需要DevKit

Installation of the gem will only require you provide additional options to gem installation (like --with-pg-dir) gem的安装仅需要您提供其他gem安装选项(例如--with-pg-dir)

subst X: "C:\\Program Files (x86)\\PostgreSQL\\8.3" gem install pg -- --with-pg-dir=X: subst X: /D 替代X:“ C:\\ Program Files(x86)\\ PostgreSQL \\ 8.3” gem install pg---with-pg-dir = X:替代X:/ D

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM