PG + extconf失败,在Linux中退出代码1 [英] PG + extconf failed, exit code 1 in Linux

查看:90
本文介绍了PG + extconf失败,在Linux中退出代码1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux(CentOS)系统中安装PG时出现错误。

I am getting error in installing PG in Linux (CentOS) System.


gem install pg

gem install pg

然后我正在出现以下错误

Then I'm getting following error

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

    current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/pg-0.18.4/ext
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160831-5454-1endyls.rb extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
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.

Provided configuration options:
    --with-opt-dir
    --without-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.3.0/bin/$(RUBY_BASE_NAME)
    --with-pg
    --without-pg
    --enable-windows-cross
    --disable-windows-cross
    --with-pg-config
    --without-pg-config
    --with-pg_config
    --without-pg_config
    --with-pg-dir
    --without-pg-dir
    --with-pg-include
    --without-pg-include=${pg-dir}/include
    --with-pg-lib
    --without-pg-lib=${pg-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/pg-0.18.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.3.0/gems/pg-0.18.4 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/pg-0.18.4/gem_make.out

对于解决方案,我尝试了很多事情并安装了必需的软件包,但仍然出现相同的错误。您可以看到我的postgres日志*

and for solution I try many things and installed required packages but still getting same error. you can see my logs for postgres*

运行后


yum list postgres *

yum list postgres*



Loaded plugins: priorities, update-motd, upgrade-helper
24 packages excluded due to repository priority protections
Installed Packages
postgresql92.x86_64                                                                   9.2.15-1.57.amzn1                                                        @amzn-main  
postgresql92-contrib.x86_64                                                           9.2.15-1.57.amzn1                                                        @amzn-main  
postgresql92-devel.x86_64                                                             9.2.15-1.57.amzn1                                                        @amzn-main  
postgresql92-libs.x86_64                                                              9.2.15-1.57.amzn1                                                        @amzn-main  
postgresql92-server.x86_64                                                            9.2.15-1.57.amzn1                                                        @amzn-main  
postgresql92-server-compat.x86_64                                                     9.2.15-1.57.amzn1                                                        @amzn-main  
postgresql93.x86_64                                                                   9.3.11-1.61.amzn1                                                        @amzn-main  
postgresql93-contrib.x86_64                                                           9.3.11-1.61.amzn1                                                        @amzn-main  
postgresql93-devel.x86_64                                                             9.3.11-1.61.amzn1                                                        @amzn-main  
postgresql93-libs.x86_64                                                              9.3.11-1.61.amzn1                                                        @amzn-main  
postgresql93-server.x86_64                                                            9.3.11-1.61.amzn1                                                        @amzn-main  
postgresql94.x86_64                                                                   9.4.6-1.66.amzn1                                                         @amzn-main  
postgresql94-libs.x86_64                                                              9.4.6-1.66.amzn1                                                         @amzn-main  
Available Packages
postgresql-jdbc.noarch                                                                8.4.701-8.11.amzn1                                                       amzn-main   
postgresql-jdbc-javadoc.noarch                                                        9.4.1208-1.rhel6                                                         pgdg92      
postgresql-odbc.x86_64                                                                08.04.0200-1.6.amzn1                                                     amzn-main   
postgresql8.x86_64                                                                    8.4.20-5.52.amzn1                                                        amzn-updates
postgresql8-contrib.x86_64                                                            8.4.20-5.52.amzn1                                                        amzn-updates
postgresql8-devel.x86_64                                                              8.4.20-5.52.amzn1                                                        amzn-updates
postgresql8-docs.x86_64                                                               8.4.20-5.52.amzn1                                                        amzn-updates
postgresql8-libs.i686                                                                 8.4.20-5.52.amzn1                                                        amzn-updates
postgresql8-libs.x86_64                                                               8.4.20-5.52.amzn1                                                        amzn-updates
postgresql8-plperl.x86_64                                                             8.4.20-5.52.amzn1                                                        amzn-updates
postgresql8-plpython.x86_64                                                           8.4.20-5.52.amzn1                                                        amzn-updates
postgresql8-pltcl.x86_64                                                              8.4.20-5.52.amzn1                                                        amzn-updates
postgresql8-server.x86_64                                                             8.4.20-5.52.amzn1                                                        amzn-updates
postgresql8-test.x86_64                                                               8.4.20-5.52.amzn1                                                        amzn-updates
postgresql92-debuginfo.x86_64                                                         9.2.18-1PGDG.rhel6                                                       pgdg92      
postgresql92-docs.x86_64                                                              9.2.15-1.57.amzn1                                                        amzn-main   
postgresql92-libs.i686                                                                9.2.15-1.57.amzn1                                                        amzn-main   
postgresql92-odbc.x86_64                                                              09.05.0400-1PGDG.rhel6                                                   pgdg92      
postgresql92-plperl.x86_64                                                            9.2.15-1.57.amzn1                                                        amzn-main   
postgresql92-plpython.x86_64                                                          9.2.18-1PGDG.rhel6                                                       pgdg92      
postgresql92-plpython26.x86_64                                                        9.2.15-1.57.amzn1                                                        amzn-main   
postgresql92-plpython27.x86_64                                                        9.2.15-1.57.amzn1                                                        amzn-main   
postgresql92-pltcl.x86_64                                                             9.2.15-1.57.amzn1                                                        amzn-main   
postgresql92-python.x86_64                                                            4.2-1PGDG.rhel6                                                          pgdg92      
postgresql92-python-debuginfo.x86_64                                                  4.2-1PGDG.rhel6                                                          pgdg92      
postgresql92-tcl.x86_64                                                               2.1.1-1.rhel6                                                            pgdg92      
postgresql92-tcl-debuginfo.x86_64                                                     2.1.1-1.rhel6                                                            pgdg92      
postgresql92-test.x86_64                                                              9.2.15-1.57.amzn1                                                        amzn-main   
postgresql93-docs.x86_64                                                              9.3.11-1.61.amzn1                                                        amzn-main   
postgresql93-libs.i686                                                                9.3.11-1.61.amzn1                                                        amzn-main   
postgresql93-plperl.x86_64                                                            9.3.11-1.61.amzn1                                                        amzn-main   
postgresql93-plpython26.x86_64                                                        9.3.11-1.61.amzn1                                                        amzn-main   
postgresql93-plpython27.x86_64                                                        9.3.11-1.61.amzn1                                                        amzn-main   
postgresql93-pltcl.x86_64                                                             9.3.11-1.61.amzn1                                                        amzn-main   
postgresql93-test.x86_64                                                              9.3.11-1.61.amzn1                                                        amzn-main   
postgresql94-contrib.x86_64                                                           9.4.6-1.66.amzn1                                                         amzn-main   
postgresql94-devel.x86_64                                                             9.4.6-1.66.amzn1                                                         amzn-main   
postgresql94-docs.x86_64                                                              9.4.6-1.66.amzn1                                                         amzn-main   
postgresql94-libs.i686                                                                9.4.6-1.66.amzn1                                                         amzn-main   
postgresql94-plperl.x86_64                                                            9.4.6-1.66.amzn1                                                         amzn-main   
postgresql94-plpython26.x86_64                                                        9.4.6-1.66.amzn1                                                         amzn-main   
postgresql94-plpython27.x86_64                                                        9.4.6-1.66.amzn1                                                         amzn-main   
postgresql94-server.x86_64                                                            9.4.6-1.66.amzn1                                                         amzn-main   
postgresql94-test.x86_64                                                              9.4.6-1.66.amzn1                                                         amzn-main   
postgresql_autodoc.noarch                                                             1.41-1.rhel6                                                             pgdg92      

无法安装pg。

我已安装


yum install postgresql92-server




Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main/latest                                                                                                                                    | 2.1 kB     00:00     
amzn-updates/latest                                                                                                                                 | 2.3 kB     00:00     
24 packages excluded due to repository priority protections
Package postgresql92-server-9.2.15-1.57.amzn1.x86_64 already installed and latest version
Nothing to do


推荐答案

似乎您必须安装postgres头文件和库。
,因为您的系统是RHEL,请尝试此操作。

it seems you have to install postgres header files and libraries. as your system is RHEL try this.

yum install postgresql-devel

如果您使用的是Postgres 9.4,则

if you are using postgres 9.4 then,

yum install postgresql94-devel

然后重新运行gem install pg'version'

then rerun gem install pg 'version'

这篇关于PG + extconf失败,在Linux中退出代码1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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