山狮队的pg gem'0.14.0'失败 [英] pg gem '0.14.0' on Mountain Lion fails

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

问题描述

我刚从OS X Lion升级到OS X Mountain Lion。
大多数情况下,我的rails环境保持完好。



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



所以一切顺利。



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



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



我使用ruby 1.9.3p125。



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



所以这让我相信它是特定于pg gem的,而不是我的整体环境,因为其他宝石安装正常。



我也尝试重新安装Postgresql以确保我的postgres环境没问题d

有没有人能够安装'pg'宝石版本0.13.0或更高版本(更可取的是0.14.X)?

p>

这是我的堆栈跟踪:

 构建原生扩展。这可能需要一段时间... 
错误:安装pg时出错:
错误:无法构建gem本机扩展。

/Users/caseyli/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
检查pg_config ...是
使用配置值从/ usr / bin / pg_config
检查libpq-fe.h ...是
检查libpq / libpq-fs.h ...是
检查pg_config_manual.h .. 。是
在-lpq中检查PQconnectdb()...是
检查PQconnectionUsedPassword()...是
检查PQisthreadsafe()...是
检查PQprepare()...是
检查PQexecParams()...是
检查PQescapeString()...是
检查PQescapeStringConn()...是
检查PQescapeLiteral()...是
检查PQescapeIdentifier()...是
检查PQgetCancel()...是
检查lo_create()...是
检查pg_encoding_to_char()...是
检查pg_char_to_encoding()...是
检查PQsetClientEncoding()...是
检查PQlibVersion()...是
检查PQping()...是
检查rb_encdb_ali as()... yes
检查rb_enc_alias()... no
检查libpq-fe.h中的PGRES_COPY_BOTH ... no
检查libpq中的struct pgNotify.extra fe.h ...是
检查unistd.h ...是
检查ruby / st.h ...是
创建extconf.h
创建Makefile


编译pg.c
pg.c:函数'pg_s_library_version':
pg.c:273:警告:函数'PQlibVersion'的隐式声明
pg.c:函数'Init_pg_ext':
pg.c:384:错误:'PQPING_OK'未声明(首次在此函数中使用)
pg.c:384:error:(Each未声明的标识符仅报告一次
pg.c:384:错误:对于它出现的每个函数。)
pg.c:386:错误:'PQPING_REJECT'未声明(在此函数中首次使用)
pg.c:388:错误:'PQPING_NO_RESPONSE'未声明(在此函数中首次使用)
pg.c:390:错误:'PQPING_NO_ATTEMPT'未声明(首次在此函数中使用)
make :*** [pg.o]错误1


宝石f iles将保留安装在/Users/caseyli/.rvm/gems/ruby-1.9.3-p125@elliottfarmequipment/gems/pg-0.14.0进行检查。


解决方案

Deefour的评论得到了它!这是我安装PostgreSQL的方式。



我使用PostgreSQL的一键安装程序,我猜测它并没有为Mountain Lion正确设置libpq。 / b>

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



通过自制软件安装postgres后

  brew install postgresql 

我能够安装我的宝石没有问题。

谢谢大家!


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

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

So all that went well.

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'.

And it specifically fails for versions above 0.12.2.

I'm using ruby 1.9.3p125.

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).

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.

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

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

Here is my stack trace:

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's comment got it! It was the way I installed PostgreSQL.

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

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

After installing postgres through homebrew

brew install postgresql

I was able to install my gem no problem.

Thanks everybody!

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

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