ruby – 无法安装pg gem

前端之家收集整理的这篇文章主要介绍了ruby – 无法安装pg gem前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
试图安装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

解决方法

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

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

$brew uninstall openssl

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

$brew install –64-bit openssl

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

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

原文链接:https://www.f2er.com/ruby/271090.html

猜你在找的Ruby相关文章