无法安装pg gem

时间:2012-03-23 21:47:20

标签: ruby macos postgresql rubygems osx-lion

尝试安装pg gem会给我带来错误。

我使用的是使用rbenv / ruby​​-build构建的Ruby 1.9.3-p125。我使用一键安装程序安装了PostgreSQL。我可以使用pgAdmin连接到数据库。我的想法已经不多了。

% 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

1 个答案:

答案 0 :(得分:14)

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

  • 1,我安装了64-bit version of PostgreSQL
  • 2,我卸载了任何旧的Homebrew OpenSSL安装

      

    $ brew uninstall openssl

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

      

    $ brew install --64位openssl

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

      

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

相关问题