Mountain Lion 上的 pg gem '0.14.0' 失败 [英] pg gem '0.14.0' on Mountain Lion fails

查看:18
本文介绍了Mountain Lion 上的 pg gem '0.14.0' 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚从 OS X Lion 升级到 OS X Mountain Lion.我的 Rails 环境大部分都保持完好.

I just upgraded from OS X Lion to OS X Mountain Lion. My rails environment for the most part stayed in tact.

要让事情恢复到良好状态,我必须做的唯一步骤是:- 安装 XCode 4.4- 安装 XCode 4.4 命令行工具- 安装 gcc-4.2

The only steps I had to do to get things back to a good state was: - Install XCode 4.4 - Install XCode 4.4 Command Line Tools - Install gcc-4.2

所以一切都很顺利.

这是问题所在,当我运行 bundle install 时,几乎所有的 gem 都正确安装,除了我需要的最重要的一个 - postgresql gem 'pg'.

Here's the issue, almost all my gems install properly when I run bundle install except for one of the most important ones I need - the postgresql gem 'pg'.

对于 0.12.2 以上的版本,它特别失败.

And it specifically fails for versions above 0.12.2.

我正在使用 ruby​​ 1.9.3p125.

I'm using ruby 1.9.3p125.

我可以成功获取 0.12.2 pg gem 和以下版本,但它们给我分段错误(我猜是因为我使用的 ruby​​ 版本).

I can successfully grab the 0.12.2 pg gem, and versions below, but they give me segmentation faults (I'm guessing because of the version of ruby I'm using).

所以这让我相信它特定于 pg gem,而不是我的整体环境,因为其他 gem 安装良好.

So this leads me to believe that it's specific to the pg gem, and not my overall environment seeing as other gems install fine.

我还尝试重新安装 Postgresql 以确保我的 postgres 环境正常并且在这方面看起来不错.

I also tried re-installing Postgresql to ensure my postgres environment is ok and seems good on that front.

是否有人能够安装 'pg' gem 版本 0.13.0 或更高版本(最好是 0.14.X)?

Has anybody been able to install the 'pg' gem version 0.13.0 or above (and more preferrably 0.14.X)?

这是我的堆栈跟踪:

Building native extensions.  This could take a while...
ERROR:  Error installing pg:
ERROR: Failed to build gem native extension.

    /Users/caseyli/.rvm/rubies/ruby-1.9.3-p125/bin/ruby 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()... 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 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 ‘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 /Users/caseyli/.rvm/gems/ruby-1.9.3-        p125@elliottfarmequipment/gems/pg-0.14.0 for inspection.

推荐答案

Deefour 的评论收到了!这是我安装 PostgreSQL 的方式.

Deefour's comment got it! It was the way I installed PostgreSQL.

我使用 PostgreSQL 一键式安装程序,我猜它没有为 Mountain Lion 正确设置 libpq.

I use the PostgreSQL one-click installer which I'm guessing doesn't set up the libpq up properly for Mountain Lion.

另一方面,Homebrew 会为操作系统正确构建它.

Homebrew on the otherhand will build it properly for the OS.

通过 homebrew 安装 postgres 后

After installing postgres through homebrew

brew install postgresql

我能够安装我的 gem 没问题.

I was able to install my gem no problem.

谢谢大家!

这篇关于Mountain Lion 上的 pg gem '0.14.0' 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆