pg_config,ruby pg,升级后的postgresql 9.0问题,centos 5 [英] pg_config, ruby pg, postgresql 9.0 problem after upgrade, centos 5

查看:182
本文介绍了pg_config,ruby pg,升级后的postgresql 9.0问题,centos 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级postgresql 8.1到9.0之后,发现库依赖关系存在问题。 Postgresql工作正常(连接,查询)。

  yum列表postgresql * 
安装的软件包
postgresql.i386 9.0.0-1PGDG.el5已安装
postgresql-debuginfo.i386 9.0.0-1PGDG.el5已安装
postgresql-devel.i386 9.0.0-1PGDG.el5已安装
postgresql-libs。 i386 9.0.0-1PGDG.el5已安装
postgresql-odbcng.i386 0.90.101-2.el5已安装
postgresql-plruby.i386已安装0.5.1-5.el5
postgresql-server .i386 9.0.0-1PGDG.el5安装

但是当我尝试安装'pg'for ruby ,ive收到

  gem install pg 
构建本机扩展。这可能需要一段时间...
错误:安装pg时出错:
错误:无法构建gem本机扩展。

/ usr / local / bin / ruby​​ extconf.rb
检查pg_config ... no
检查libpq-fe.h ... no
Can '找不到'libpq-fe.h头文件
*** extconf.rb失败***
由于某些原因无法创建Makefile,可能缺少
必需的库和/或头。查看mkmf.log文件以获取更多
的详细信息。您可能需要配置选项。

当尝试使用另一个ruby-postgres驱动程序时,我得到了

  yum install ruby​​-postgres 
epel的ruby-postgres-0.7.1-5.el5.i386解决了问题
- >缺少相关性:package需要libpq.so.4 ruby​​-postgres-0.7.1-5.el5.i386(epel)

  locate libpq.so.4 
/usr/lib/libpq.so .4
/usr/lib/libpq.so.4.1

也输出路径 p>

  LD_LIBRARY_PATH = / usr / pgsql-9.0 / lib 
export LD_LIBRARY_PATH

在使用require pg(适用于8.1)运行ruby脚本之后,我得到了:

  /usr/local/lib/ruby/site_ruby/1.8/i686-linux/pg_ext.so:libpq.so.4:无法打开共享对象文件:没有这样的文件或目录 -  / usr /local/lib/ruby/site_ruby/1.8/i686-linux/pg_ext.so(LoadError)/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in`require中的
'from /usr/local/lib/ruby/site_ruby/1.8/pg.rb:12
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:在/ usr / local / lib / ruby​​ / s的`gem_original_require'
中ite_ruby / 1.8 / ruby​​gems / custom_require.rb:29:在`require'

任何建议做什么更多?

解决方案

您可以将各种配置选项添加到gem install中,如 -with- opt-dir - with-pg-dir - with-pg-config 。看看这个邮件列表的主题:



http:// www。 ruby-forum.com/topic/409608


After upgrade postgresql 8.1 to 9.0 ive noticed issues with libraries dependency. Postgresql works fine (connection, queries).

yum list postgresql*
Installed Packages
postgresql.i386 9.0.0-1PGDG.el5 installed
postgresql-debuginfo.i386 9.0.0-1PGDG.el5 installed
postgresql-devel.i386 9.0.0-1PGDG.el5 installed
postgresql-libs.i386 9.0.0-1PGDG.el5 installed
postgresql-odbcng.i386 0.90.101-2.el5 installed
postgresql-plruby.i386 0.5.1-5.el5 installed
postgresql-server.i386 9.0.0-1PGDG.el5 install

but when im trying to install 'pg' for ruby, ive received

gem install pg
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb
checking for pg_config... no
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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.

When trying with another ruby-postgres driver, ive got

yum install ruby-postgres
ruby-postgres-0.7.1-5.el5.i386 from epel has depsolving problems
  --> Missing Dependency: libpq.so.4 is needed by package ruby-postgres-0.7.1-5.el5.i386 (epel)

and

locate libpq.so.4
/usr/lib/libpq.so.4
/usr/lib/libpq.so.4.1

also exported path

LD_LIBRARY_PATH=/usr/pgsql-9.0/lib
export LD_LIBRARY_PATH

after running ruby script with "require pg" (works on 8.1), ive got:

/usr/local/lib/ruby/site_ruby/1.8/i686-linux/pg_ext.so: libpq.so.4: cannot open shared object file: No such file or directory - /usr/local/lib/ruby/site_ruby/1.8/i686-linux/pg_ext.so (LoadError)
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
        from /usr/local/lib/ruby/site_ruby/1.8/pg.rb:12
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'

Any suggestions what to do more?

解决方案

There are various config options you can add to the gem install, like -with-opt-dir, --with-pg-dir and --with-pg-config. Look at this mailing list thread:

http://www.ruby-forum.com/topic/409608

这篇关于pg_config,ruby pg,升级后的postgresql 9.0问题,centos 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆