ruby - 在 os x 上安装 pg 0.15.1 时出错

标签 ruby rubygems osx-lion pg

这就是当我尝试在 OS X Lion 上安装最新版本的 Postgres gem 时发生的情况。

$ gem install pg
Upgraded http://rubygems.org/ to HTTPS
Fetching: pg-0.15.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    /.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /Applications/Postgres.app/Contents/MacOS/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()... yes
checking for PQisthreadsafe()... yes
checking for PQprepare()... yes
checking for PQexecParams()... yes
checking for PQescapeString()... yes
checking for PQescapeStringConn()... yes
checking for PQescapeLiteral()... yes
checking for PQescapeIdentifier()... 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 PQlibVersion()... yes
checking for PQping()... yes
checking for PQsetSingleRowMode()... yes
checking for rb_encdb_alias()... yes
checking for rb_enc_alias()... yes
checking for rb_thread_call_without_gvl()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_fd_select()... yes
checking for rb_w32_wrap_io_handle()... no
checking for PGRES_COPY_BOTH in libpq-fe.h... no
checking for PGRES_SINGLE_TUPLE in libpq-fe.h... no
checking for struct pgNotify.extra in libpq-fe.h... yes
checking for unistd.h... yes
checking for ruby/st.h... yes
creating extconf.h
creating Makefile

make
compiling gvl_wrappers.c
compiling pg.c
pg.c: In function ‘pg_s_library_version’:
pg.c:273: warning: implicit declaration of function ‘PQlibVersion’
pg.c: In function ‘Init_pg_ext’:
pg.c:384: error: ‘PQPING_OK’ undeclared (first use in this function)
pg.c:384: error: (Each undeclared identifier is reported only once
pg.c:384: error: for each function it appears in.)
pg.c:386: error: ‘PQPING_REJECT’ undeclared (first use in this function)
pg.c:388: error: ‘PQPING_NO_RESPONSE’ undeclared (first use in this function)
pg.c:390: error: ‘PQPING_NO_ATTEMPT’ undeclared (first use in this function)
make: *** [pg.o] Error 1


Gem files will remain installed in /.rvm/gems/ruby-2.0.0-p0@myapp/gems/pg-0.15.1 for inspection.
Results logged to /.rvm/gems/ruby-2.0.0-p0@myapp/gems/pg-0.15.1/ext/gem_make.out

如何解决这个问题?

最佳答案

尝试通过以下方式安装 PG

brew 安装 postgresql

然后尝试重新运行 bundle 看看是否有效

关于ruby - 在 os x 上安装 pg 0.15.1 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15914724/

相关文章:

ruby-on-rails - 确保 Rollbar 已使用 RSpec 报告错误

Windows 上 vim 支持的 ruby

ios - 我可以将 kindle-highlights gem 与 RubyMotion 一起使用吗

jquery - twitter-bootstrap-rails 未捕获的 TypeError/$ 不是函数

c++ - 在 Mac OSX 10.7.4 上编译简单的 Qwt 程序时出错

ruby - 解析具有嵌套信息结构的纯文本文件的最佳方法

ruby-on-rails - URI::InvalidURIError: 错误的 URI(不是 URI?)测试 Rails Controller

ruby-on-rails - 如何在 Ruby 中为新添加的模型生成 sorbet.rbi 文件?

cocoa - 如何知道 Mac OS X Lion 中的 NSWindow 是否全屏?

c++ - OpenCV 未填满整个图像