【问题标题】:Error install pg gem错误安装 pg gem
【发布时间】:2013-04-23 13:45:37
【问题描述】:

尝试安装“pg”时出现以下错误有什么想法吗?我对 Rails 很陌生,所以我不确定如何解决这个问题。

Davids-MacBook-Air:~ DavidStevenson$ install pg
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 file2
       install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 ... fileN directory
       install -d [-v] [-g group] [-m mode] [-o owner] directory ...
Davids-MacBook-Air:~ DavidStevenson$ gem install pg
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    /usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb


make
compiling gvl_wrappers.c
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


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/pg-0.15.1     for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p392/gems/pg-0.15.1/ext/gem_make.out

【问题讨论】:

    标签: ruby-on-rails postgresql gem pg


    【解决方案1】:

    您可能需要首先使用(homebrew、macports、fink)之一安装 postgresql 开发库。我个人仍然喜欢 macports,但 homebrew 似乎越来越受欢迎。如果这仍然不起作用,您可能需要将一些标志传递给“gem install”命令,以告诉它在哪里可以找到这些库。

    【讨论】:

    • 如果我的回答对您有用,您介意将其标记为已接受吗?
    【解决方案2】:

    请尝试以下链接在 Mac 上安装 postgres:

    how to install postgresql for mac os x

    Installing Postgresql on Mac Lion

    【讨论】:

      猜你喜欢
      • 2016-05-02
      • 2016-10-04
      • 1970-01-01
      • 2018-10-01
      • 2014-01-16
      • 2021-08-18
      • 2020-01-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多