ruby-on-rails - pg gem 安装失败

标签 ruby-on-rails cygwin pg

我正在尝试使用heroku让Rails与Cygwin一起工作,但是当我这样做时遇到了问题

bundle install

我很确定 postgres 已安装(我从 Cygwin 的 setup.exe 安装了标题中带有“postgres”的所有内容,但遇到了问题

gem install pg

,我无法理解错误消息。

如果这个问题很微不足道,我们深表歉意;这是我第一次尝试学习RoR。错误日志如下。提前致谢!

/usr/bin/ruby.exe extconf.rb
checking for pg_config... yes
Using config values from /usr/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... yes
checking for PQconnectionUsedPassword()... no
checking for PQisthreadsafe()... yes
checking for PQprepare()... yes
checking for PQexecParams()... yes
checking for PQescapeString()... yes
checking for PQescapeStringConn()... yes
checking for PQgetCancel()... yes
checking for lo_create()... yes
checking for pg_encoding_to_char()... yes
checking for pg_char_to_encoding()... yes
checking for PQsetClientEncoding()... yes
checking for rb_encdb_alias()... no
checking for rb_enc_alias()... no
checking for struct pgNotify.extra in libpq-fe.h... yes
checking for unistd.h... yes
checking for ruby/st.h... no
checking for st.h... yes
creating extconf.h
creating Makefile

make
gcc -I. -I. -I/usr/lib/ruby/1.8/i386-cygwin -I. -DRUBY_EXTCONF_H=\"extconf.h\"    -I/us /include -g -O2 -pipe  -fno-strict-aliasing    -c pg.c
gcc -I. -I. -I/usr/lib/ruby/1.8/i386-cygwin -I. -DRUBY_EXTCONF_H=\"extconf.h\"    -I/usr/include -g -O2 -pipe  -fno-strict-aliasing    -c pg_connection.c
gcc -I. -I. -I/usr/lib/ruby/1.8/i386-cygwin -I. -DRUBY_EXTCONF_H=\"extconf.h\"    -I/usr/include -g -O2 -pipe  -fno-strict-aliasing    -c pg_result.c
gcc -shared -s -o pg_ext.so pg.o pg_connection.o pg_result.o -L. -L/usr/lib -L.  -L/usr/lib -Wl,--enable-auto-image-base,--enable-auto-import,--export-all   -lruby -lpq  -lrt -ldl -lcrypt  
pg_connection.o: In function 'pgconn_connection_needs_password':
/usr/lib/ruby/gems/1.8/gems/pg-0.13.1/ext/pg_connection.c:714: undefined reference to `_PQconnectionNeedsPassword'
pg_connection.o: In function 'pgconn_connection_used_password':
/usr/lib/ruby/gems/1.8/gems/pg-0.13.1/ext/pg_connection.c:727: undefined reference to `_PQconnectionUsedPassword'
pg_connection.o: In function 'pgconn_lotruncate':
/usr/lib/ruby/gems/1.8/gems/pg-0.13.1/ext/pg_connection.c:2991: undefined reference to `_lo_truncate'
collect2: ld returned 1 exit status
Makefile:152: recipe for target `pg_ext.so' failed
make: *** [pg_ext.so] Error 1

最佳答案

gem 0.13 版本不支持 8.3 之前的 PostgreSQL 版本。您需要升级 Postgres 或安装较旧的 gem(例如 gem install pg -v '< 0.13' )。

“pg” gem 如下 PostgreSQL's versioning policy .

关于ruby-on-rails - pg gem 安装失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9392939/

相关文章:

ruby-on-rails - Passenger、Nginx 和 Capistrano - Passenger 根本不启动 Rails 应用程序

c - 使用 eclipse 和 cygwin 调试 C

javascript - nodejs pg-promise获取函数范围之外的变量

ruby-on-rails - 如何在 Heroku 上的自定义域上使用 HTTPS?

ruby-on-rails - Rails/在 View 中使用模型

ruby-on-rails - 至少 6 个字符的密码不起作用 [rails 4]

sed - Grep 数据并输出到文件

c - 为什么我的 calloc 无法将所有内容清零?

sql - Go 和多行参数 hell

node.js - PG(node-postgres)VS。 Sequelize