gem install pg can not bind to libpq

时光总嘲笑我的痴心妄想 提交于 2019-11-28 18:19:18

I've got the same problem in my case was lib's inside .rvm/usr/lib which was taken to this compilation instead of lib's from system. I'm not sure why that happens and why it doesn't work (in my case on Ubuntu 10.04 x86_64) but to solve it just :

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

for a while or forever ;)

If someone will investigate why that happen I will be appreciate. Regards.

Look at the mkmf.log around line 39:

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

Smells like a missing OpenSSL. I also don't see a -lssl in the library list but the missing symbols suggest that it should be there.

So try installing the OpenSSL libraries (version 0.9.8 by the look of things). Then see if pg_config --libs contains -lssl or similar and try again. If all of this works then you might want to send a bug report to the Ubuntu people so that they can fix the libpq-dev dependencies.

Sorry, I don't have an Ubuntu set up anywhere accessible at the moment so there is some guesswork going on here.

Don't be fooled by the SSL lib being installed - have a look at your Ruby build and check the ssl build log there. I've been bitten by that one before. Other libraries that sometimes don't get loaded are the GZip ones. This may not be the problem but have a look.

UPDATE:

You need the -dev libraries.

These days I use rbenv or one of the other ruby build tools and follow whatever messages they spit out.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!