gem install pg无法绑定到libpq

时间:2012-01-11 06:10:46

标签: ruby postgresql ubuntu pg ruby-1.9.3

在Ubuntu 10.04.3上升级到Ruby 1.9.3(使用系统RVM的1.9.2)后,我删除了所有宝石,并尝试重新安装pg(ala bundle install pg)。

然后它抛出一个错误并通知我应该查看mkmf.log,这两个都包含在这个要点中:https://gist.github.com/d05a81701d968895c730

libpq-dev,libpq5和postgresql-client都已​​安装并正常运行。 在pg_config中指向gem,直接指向include和bin目录似乎没有任何改变。

我已经看到几个关于stackoverflow和网络其余部分的类似错误消息的问题,但它们似乎都很简单,缺少依赖性问题(大多数是通过安装libpq-dev解​​决的),所以我是有点失落。

可能有用/相关的各种其他属性:

  • ruby​​ 1.9.3p0(2011-10-30修订版33570)[i686-linux]
  • rvm 1.10.1(系统)
  • gem 1.8.15
  • psql(PostgreSQL)8.4.9

提前致谢。

gem_make.out:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/local/rvm/rubies/ruby-1.9.3-p0/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 PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

ldd.stdout:

$ldd /usr/lib/libpq.so
    linux-gate.so.1 =>  (0xf57fe000)
    libssl.so.0.9.8 => /lib/i686/cmov/libssl.so.0.9.8 (0xb77f4000)
    libcrypto.so.0.9.8 => /lib/i686/cmov/libcrypto.so.0.9.8 (0xb76a2000)
    libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0xb75f1000)
    libcom_err.so.2 => /lib/libcom_err.so.2 (0xb75ec000)
    libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0xb75bd000)
    libcrypt.so.1 => /lib/tls/i686/cmov/libcrypt.so.1 (0xb758b000)
    libldap_r-2.4.so.2 => /usr/lib/libldap_r-2.4.so.2 (0xb7544000)
    libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb752b000)
    libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb73d0000)
    libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb73cc000)
    libz.so.1 => /lib/libz.so.1 (0xb73b7000)
    libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0xb7393000)
    libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0xb738b000)
    libkeyutils.so.1 => /lib/libkeyutils.so.1 (0xb7386000)
    libresolv.so.2 => /lib/tls/i686/cmov/libresolv.so.2 (0xb7372000)
    /lib/ld-linux.so.2 (0xb786a000)
    liblber-2.4.so.2 => /usr/lib/liblber-2.4.so.2 (0xb7365000)
    libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0xb734d000)
    libgnutls.so.26 => /usr/lib/libgnutls.so.26 (0xb72b2000)
    libtasn1.so.3 => /usr/lib/libtasn1.so.3 (0xb72a0000)
    libgcrypt.so.11 => /lib/libgcrypt.so.11 (0xb722d000)
    libgpg-error.so.0 => /lib/libgpg-error.so.0 (0xb7228000)

pgconfig.stdout:

$pg_config --ldflags --libs

-Wl,-Bsymbolic-functions -Wl,--as-needed -Wl,--as-needed
-lpgport -lxslt -lxml2 -lpam -lssl -lcrypto -lkrb5 -lcom_err -lgssapi_krb5 -lz -lreadline -lcrypt -ldl -lm 

mkmf.log:

find_executable: checking for pg_config... -------------------- yes

--------------------

find_header: checking for libpq-fe.h... -------------------- yes

"gcc -o conftest -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include  -D_FILE_OFFSET_BITS=64  -I/usr/include/postgresql  -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC conftest.c  -L. -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/usr/lib -Wl,-R/usr/local/rvm/usr/lib -L.  -rdynamic -Wl,-export-dynamic -L/usr/lib     -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -lruby  -lpthread -lrt -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main() {return 0;}
/* end */

"gcc -E -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include  -D_FILE_OFFSET_BITS=64  -I/usr/include/postgresql  -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <libpq-fe.h>
/* end */

--------------------

find_header: checking for libpq/libpq-fs.h... -------------------- yes

"gcc -E -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include  -D_FILE_OFFSET_BITS=64  -I/usr/include/postgresql  -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <libpq/libpq-fs.h>
/* end */

--------------------

have_library: checking for PQconnectdb() in -lpq... -------------------- no

"gcc -o conftest -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include  -D_FILE_OFFSET_BITS=64  -I/usr/include/postgresql  -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC conftest.c  -L. -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/usr/lib -Wl,-R/usr/local/rvm/usr/lib -L.  -rdynamic -Wl,-export-dynamic -L/usr/lib     -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -lruby -lpq  -lpthread -lrt -ldl -lcrypt -lm   -lc"
/usr/lib/libpq.so: undefined reference to `X509_STORE_set_flags@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `CRYPTO_set_locking_callback@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ENGINE_init@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ENGINE_free@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ENGINE_load_private_key@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ENGINE_finish@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `X509_check_private_key@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `X509_free@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_new@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_pending@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `TLSv1_method@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `X509_STORE_load_locations@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_set_verify@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ERR_pop_to_mark@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_new@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_get_error@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ERR_get_error@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ENGINE_by_id@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_write@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_load_error_strings@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_load_verify_locations@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `BIO_ctrl@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `PEM_read_bio_PrivateKey@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `CRYPTO_set_id_callback@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_free@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `BIO_free@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_get_cert_store@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `X509_get_subject_name@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_shutdown@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_set_client_cert_cb@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `PEM_read_bio_X509@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ERR_set_mark@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `OPENSSL_config@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `X509_NAME_get_text_by_NID@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_read@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_ctrl@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ERR_reason_error_string@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_get_peer_certificate@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `X509_NAME_oneline@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_set_ex_data@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_set_fd@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_library_init@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `CRYPTO_num_locks@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_get_ex_data@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `SSL_connect@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `BIO_new_file@OPENSSL_0.9.8'
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <libpq-fe.h>
4: 
5: /*top*/
6: int main() {return 0;}
7: int t() { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return 0; }
/* end */

"gcc -o conftest -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include  -D_FILE_OFFSET_BITS=64  -I/usr/include/postgresql  -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC conftest.c  -L. -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/usr/lib -Wl,-R/usr/local/rvm/usr/lib -L.  -rdynamic -Wl,-export-dynamic -L/usr/lib     -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -lruby -lpq  -lpthread -lrt -ldl -lcrypt -lm   -lc"
conftest.c: In function 't':
conftest.c:7: error: too few arguments to function 'PQconnectdb'
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <libpq-fe.h>
4: 
5: /*top*/
6: int main() {return 0;}
7: int t() { PQconnectdb(); return 0; }
/* end */

--------------------

have_library: checking for PQconnectdb() in -llibpq... -------------------- no

"gcc -o conftest -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include  -D_FILE_OFFSET_BITS=64  -I/usr/include/postgresql  -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC conftest.c  -L. -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/usr/lib -Wl,-R/usr/local/rvm/usr/lib -L.  -rdynamic -Wl,-export-dynamic -L/usr/lib     -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -lruby -llibpq  -lpthread -lrt -ldl -lcrypt -lm   -lc"
/usr/bin/ld: cannot find -llibpq
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <libpq-fe.h>
4: 
5: /*top*/
6: int main() {return 0;}
7: int t() { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return 0; }
/* end */

"gcc -o conftest -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include  -D_FILE_OFFSET_BITS=64  -I/usr/include/postgresql  -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC conftest.c  -L. -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/usr/lib -Wl,-R/usr/local/rvm/usr/lib -L.  -rdynamic -Wl,-export-dynamic -L/usr/lib     -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -lruby -llibpq  -lpthread -lrt -ldl -lcrypt -lm   -lc"
conftest.c: In function 't':
conftest.c:7: error: too few arguments to function 'PQconnectdb'
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <libpq-fe.h>
4: 
5: /*top*/
6: int main() {return 0;}
7: int t() { PQconnectdb(); return 0; }
/* end */

--------------------

have_library: checking for PQconnectdb() in -lms/libpq... -------------------- no

"gcc -o conftest -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include  -D_FILE_OFFSET_BITS=64  -I/usr/include/postgresql  -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC conftest.c  -L. -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/usr/lib -Wl,-R/usr/local/rvm/usr/lib -L.  -rdynamic -Wl,-export-dynamic -L/usr/lib     -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -lruby -lms/libpq  -lpthread -lrt -ldl -lcrypt -lm   -lc"
/usr/bin/ld: cannot find -lms/libpq
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <libpq-fe.h>
4: 
5: /*top*/
6: int main() {return 0;}
7: int t() { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return 0; }
/* end */

"gcc -o conftest -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include  -D_FILE_OFFSET_BITS=64  -I/usr/include/postgresql  -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC conftest.c  -L. -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/usr/lib -Wl,-R/usr/local/rvm/usr/lib -L.  -rdynamic -Wl,-export-dynamic -L/usr/lib     -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -lruby -lms/libpq  -lpthread -lrt -ldl -lcrypt -lm   -lc"
conftest.c: In function 't':
conftest.c:7: error: too few arguments to function 'PQconnectdb'
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <libpq-fe.h>
4: 
5: /*top*/
6: int main() {return 0;}
7: int t() { PQconnectdb(); return 0; }
/* end */

--------------------

3 个答案:

答案 0 :(得分:64)

我遇到了同样的问题,就是lib里面的.rvm / usr / lib,它是从这个编译而不是lib来自系统的。我不确定为什么会发生这种情况以及为什么它不起作用(在我的情况下在Ubuntu 10.04 x86_64上)但只是解决它:

 mv ~/.rvm/usr/lib ~/.rvm/usr/lib_rvm

一段时间或永​​远;)

如果有人会调查为什么会这样,我将不胜感激。 问候。

答案 1 :(得分:1)

查看第39行周围的mkmf.log

"gcc -o conftest -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/usr/local/rvm/usr/include  -D_FILE_OFFSET_BITS=64  -I/usr/include/postgresql  -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC conftest.c  -L. -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/usr/lib -Wl,-R/usr/local/rvm/usr/lib -L.  -rdynamic -Wl,-export-dynamic -L/usr/lib     -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p0/lib -lruby -lpq  -lpthread -lrt -ldl -lcrypt -lm   -lc"
/usr/lib/libpq.so: undefined reference to `X509_STORE_set_flags@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `CRYPTO_set_locking_callback@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ENGINE_init@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ENGINE_free@OPENSSL_0.9.8'
/usr/lib/libpq.so: undefined reference to `ENGINE_load_private_key@OPENSSL_0.9.8'
...

闻起来像是缺少OpenSSL。我也没有在库列表中看到-lssl,但缺少的符号表明它应该在那里。

所以尝试安装OpenSSL库(事情看起来是0.9.8版本)。然后查看pg_config --libs是否包含-lssl或类似内容,然后重试。如果所有这些都有效,那么您可能希望向Ubuntu人员发送错误报告,以便他们可以修复libpq-dev依赖项。

很抱歉,我目前无法在任何地方设置Ubuntu,所以这里有一些猜测。

答案 2 :(得分:1)

不要被安装的SSL lib愚弄 - 看看你的Ruby构建并检查那里的ssl构建日志。我以前被那个人咬了。其他有时无法加载的库是GZip库。这可能不是问题,但看看。

更新:

您需要-dev库。

这些天我使用rbenv或其他ruby构建工具之一,并按照他们吐出的任何消息。