安装 pg gem 时遇到问题 [英] Trouble installing pg gem

查看:37
本文介绍了安装 pg gem 时遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试安装 pg gem 时出现错误.

Trying to install the pg gem gives me errors.

我正在使用使用 rbenv/ruby-build 构建的 Ruby 1.9.3-p125.我使用一键式安装程序安装了 PostgreSQL.我可以使用 pgAdmin 连接到数据库.我的想法不多了.

I'm using Ruby 1.9.3-p125 built using rbenv/ruby-build. I installed PostgreSQL using the one-click installer. I'm able to connect to the DB using pgAdmin. I'm running out of ideas.

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

        /Users/sandropadin/.rbenv/versions/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 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 rb_encdb_alias()... yes
checking for rb_enc_alias()... yes
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
compiling pg_connection.c
pg_connection.c: In function ‘pgconn_wait_for_notify’:
pg_connection.c:1986: warning: ‘rb_thread_select’ is deprecated (declared at /Users/sandropadin/.rbenv/versions/1.9.3-p125/include/ruby-1.9.1/ruby/intern.h:379)
pg_connection.c: In function ‘pgconn_block’:
pg_connection.c:2512: warning: ‘rb_thread_select’ is deprecated (declared at /Users/sandropadin/.rbenv/versions/1.9.3-p125/include/ruby-1.9.1/ruby/intern.h:379)
compiling pg_result.c
linking shared-object pg_ext.bundle
ld: in /usr/local/lib/libssl.0.9.8.dylib, missing required architecture x86_64 in file for architecture x86_64
collect2: ld returned 1 exit status
make: *** [pg_ext.bundle] Error 1


Gem files will remain installed in /Users/sandropadin/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/pg-0.13.2 for inspection.
Results logged to /Users/sandropadin/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/pg-0.13.2/ext/gem_make.out

推荐答案

不确定以下哪个步骤最终解决了这个问题.但由于 mu 太短,问题在于混合 32 位和 64 位二进制文​​件.

Not sure which of the following steps finally cleared this issue up. But as mu is too short mentioned, the problem was mixing 32bit and 64bit binaries.

  • 1st, I installed this 64-bit version of PostgreSQL
  • 2nd, I uninstalled any old Homebrew OpenSSL installation

$ brew uninstall openssl

$ brew uninstall openssl

  • 第三,我用 Homebrew 安装了 64 位版本的 OpenSSL

  • 3rd, I installed the 64-bit version of OpenSSL with Homebrew

    $ brew install --64-bit openssl

    $ brew install --64-bit openssl

  • 最后,在安装 pg gem 时,我将 LDFLAGS 更改为指向 64 位版本的 OpenSSL

  • Lastly, when installing the pg gem, I changed the LDFLAGS to point to the 64-bit version of OpenSSL

    $ gem install pg -- --with-ldflags='-L/usr/local/Cellar/openssl/0.9.8s'

    $ gem install pg -- --with-ldflags='-L/usr/local/Cellar/openssl/0.9.8s'

  • 这篇关于安装 pg gem 时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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