在 Windows 上安装 PG Gem 时出错 [英] Error Installing PG Gem on Windows
问题描述
我使用 XAMPP 作为 PostgreSQL 9.3 的安装文件夹.
I'm using XAMPP as my installation folder for PostgreSQL 9.3.
C:\xampp\pgsql\9.3
C:\xampp\pgsql\9.3
现在我正在尝试使用该目录作为参考安装 PostgreSQL gem:
And now I'm trying to install PostgreSQL gem using that directory as a reference:
gem install pg -- --with-pg-include="C:\xampp\pgsql\9.3\include" --with-pg-lib="C:\xampp\pgsql\9.3\lib" --with-pg-config="C:\xampp\pgsql\9.3\bin\pg_config"
但是这个命令失败了,错误如下:
But this command failed with errors listed below:
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
C:/Ruby/Ruby200/bin/ruby.exe extconf.rb --with-pg-include=C:\xampp\pgsql\9.3
\include --with-pg-lib=C:\xampp\pgsql\9.3\lib --with-pg-config=C:\xampp\pgsql\9.
3\bin\pg_config
Using config values from C:\xampp\pgsql\9.3\bin\pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Cant find the PostgreSQL client library (libpq)
*** 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:/Ruby/Ruby200/bin/ruby
--with-pg
--without-pg
--with-pg-config
--with-pg-dir
--without-pg-dir
--with-pg-include=${pg-dir}/include
--with-pg-lib=${pg-dir}/
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/pg-0
.17.1 for inspection.
Results logged to C:/Ruby/Ruby200/lib/ruby/gems/2.0.0/extensions/x86-mingw32/2.0
.0/pg-0.17.1/gem_make.out
我在pgsql里面查看的时候,里面居然有一个名为libpq.dll的文件
When I checked inside pgsql, there was actually a file named libpq.dll inside of
C:\xampp\pgsql\9.3\lib
C:\xampp\pgsql\9.3\lib
那为什么报错说找不到PostgreSQL客户端库(libpq)??
有没有针对此错误的解决方案?
仅供参考,我正在使用:
So why did the error say it couldn't find the PostgreSQL client library (libpq)??
Is there any solutions for this error?
FYI, I'm using:
- Windows 8.1 64 位
- Ruby 2.0.0 64 位
- Rails 4.1.1
- Devkit 4.7.2 64 位
- PostgreSQL 9.3.4 64 位
我正在尝试安装 PG Gem 0.17.1 版
And I'm trying to install PG Gem version 0.17.1
推荐答案
作为评论的后续,看来你必须使用32-bit
Windows 上的 Postgres.
As a follow-up to the comments, it looks like you've got to use 32-bit
Postgres on Windows.
这很可能与 pg
gem 与 mingw32
一起工作的想法有关,尽管我不完全确定
This is most likely to do with the idea that the pg
gem works with mingw32
, although I'm not totally sure
这篇关于在 Windows 上安装 PG Gem 时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!