我使用RVM和ruby 2.0.0。当我尝试安装PostgreSQL的gem时,我得到以下回应。为PostgreSQL,openssl库安装gem pg
创业板安装PG
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.0.0-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 pg_config_manual.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.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/rvm/rubies/ruby-2.0.0-p0/bin/ruby
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.0.0-p0/gems/pg-0.14.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.0.0-p0/gems/pg-0.14.1/ext/gem_make.out
试过谷歌它,显然这个问题是OpenSSL库,因为在mkmf.log输出
have_library: checking for PQconnectdb() in -lpq... -----------------$
"gcc -o conftest -I/usr/local/rvm/rubies/ruby-2.0.0-p0/include/ruby-2$
conftest.c: In function 't':
conftest.c:8:32: warning: variable 'p' set but not used [-Wunused-but$
/usr/lib/libpq.so: undefined reference to `[email protected]_1.0.$
/usr/lib/libpq.so: undefined reference to `[email protected]$
/usr/lib/libpq.so: undefined reference to `SSL_CTX_load_verify_locati$
/usr/lib/libpq.so: undefined reference to `[email protected]_1.$
/usr/lib/libpq.so: undefined reference to `[email protected]$
/usr/lib/libpq.so: undefined reference to `[email protected]_1.0.0'
/usr/lib/libpq.so: undefined reference to `[email protected]_1.0.0'
/usr/lib/libpq.so: undefined reference to `[email protected]_1.0.$
/usr/lib/libpq.so: undefined reference to `[email protected]_1.0.0'
/usr/lib/libpq.so: undefined reference to `[email protected]$
/usr/lib/libpq.so: undefined reference to `[email protected]$
/usr/lib/libpq.so: undefined reference to `[email protected]_1.0.0'
/usr/lib/libpq.so: undefined reference to `[email protected]$
/usr/lib/libpq.so: undefined reference to `[email protected]$
/usr/lib/libpq.so: undefined reference to `[email protected]_1.0.0'
然后我使用OpenSSL重新安装红宝石目录中指定的
openssl version -d
OPENSSLDIR: "/usr/lib/ssl"
rvm reinstall 2.0.0 --with-openssl-dir=/usr/lib/ssl
而且仍然是同样的问题。
试图安装宝石--with-pg-config标志。同样的问题。
在很多网站
mv $rvm_path/usr/lib $rvm_path/usr/rvm_lib
gem install pg
mv $rvm_path/usr/rvm_lib $rvm_path/usr/lib
错误试图找到共同的解决方法是不同的,虽然这段时间。
创业板安装PG
Error loading RubyGems plugin "/usr/local/rvm/gems/[email protected]/gems/rubygems-bundler-1.1.1/lib/rubygems_plugin.rb": /usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/x86_64-linux/openssl.so: undefined symbol: SSLv2_method - /usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/x86_64-linux/openssl.so (LoadError)
ERROR: Loading command: install (LoadError)
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/x86_64-linux/openssl.so: undefined symbol: SSLv2_method - /usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/x86_64-linux/openssl.so
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
假设它仍然试图从红宝石目录得到openssl.so - 问题是用Ruby使用错误的openssl.so文件。但事实是,我用--with-openssl-dir标志重新编译了它。
对此有何建议?我从字面上坚持了前10个小时尝试每个解决方法,我可以找到。
试试这个http://railsapps.github.com/openssl-certificate-verify-failed.html来安装openssl – 2013-03-03 14:57:21
Nick,这不是关于验证,而是关于使用不同OpenSSL库的Ruby和Postgre。感谢您的帮助,我找到了一个解决方案。 – dimkagfx 2013-03-03 15:00:27
RVM PKG安装OpenSSL的 RVM重新安装2.0.0 创业板安装PG应该工作,依靠RVM帮助您管理您的OpenSSL /依赖性 – bjhaid 2013-03-03 15:44:56