【问题标题】:Missing PG headers ( trying to install Postgres gem for Rails with Brew )缺少 PG 标头(尝试使用 Brew 为 Rails 安装 Postgres gem)
【发布时间】:2013-04-01 13:49:08
【问题描述】:
checking for libpq-fe.h... *** extconf.rb failed ***

似乎是问题所在,来自这条尾巴:

ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

        /Users/elephanttrip/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
checking for libpq-fe.h... *** 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.

我在 Mountain Lion Mac OS 上重现此问题的步骤是:

  1. brew install postgresql
  2. env ARCHFLAGS="-arch x86_64" gem install pg

我试图通过我的计算机查明不同的 pg_config。一个在 Brew 的地窖里,一个由 Brew cp'd 到/user/local,另一个可能来自之前的下载。它们都不起作用。

更新

只是尝试在没有配置选项的情况下安装。并得到了一个大声笑:

ruby extconf.rb --without-pg-config
checking for pg_config... yes

【问题讨论】:

  • 你是不是brew unlink先卸载了所有版本?
  • 是的,我做到了。我开始认为这可能是 rvm 问题。

标签: ruby-on-rails postgresql osx-mountain-lion pg


【解决方案1】:

我开始想象我的问题与它所说的跟踪底部的 RVM 有关..:

"You need to download development tools"

然后我做了:

$ rvm autolibs enable
$ rvm requirements

然后我继续更新了我的 ruby​​(如果您不这样做,那么我建议您重新安装当前的。如果没有autolibs enable,我无法做到这一点):

$ rvm install ruby-2.0.0-p0

轰隆隆!解决了!!!! (:D :D :D :D :D) x 1,000,000

【讨论】:

    猜你喜欢
    • 2011-08-27
    • 1970-01-01
    • 1970-01-01
    • 2011-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-21
    相关资源
    最近更新 更多