【问题标题】:pg gem error with Ruby on RailsRuby on Rails 的 pg gem 错误
【发布时间】:2013-01-13 17:16:23
【问题描述】:

我使用的是 Mac OS X 10.8.2。我使用 RailsInstaller 安装 Ruby+RVM,所以我目前使用的是 ruby​​-1.9.3-p194。我的应用程序使用 Rails 3.2.11。

当我运行 bundle install 时,我看到的错误如下:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb --with-pg-config=/usr/bin/pg_config
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()... 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 rb_encdb_alias()... yes
checking for rb_enc_alias()... 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 pg.c
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

请注意,这不是 pg_config 的问题。 StackOverflow 上对类似问题的回答都表明此二进制文件丢失(或未找到),因此是错误的问题。据我所知,这似乎是一个不同的问题。

关于如何解决此问题的任何想法?

谢谢!

林哥

【问题讨论】:

    标签: ruby-on-rails-3 postgresql bundler pg


    【解决方案1】:

    我使用自制软件安装 pg 并解决了我的问题:

    $ brew install postgres
    

    【讨论】:

    • "brew install pg 说“没有可用的公式”。明确说明你做了什么“解决了你的问题”。
    猜你喜欢
    • 2021-08-18
    • 1970-01-01
    • 2017-06-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-15
    • 2019-03-01
    相关资源
    最近更新 更多