PG + extconf失败,在Linux中退出代码1

时间:2016-08-31 13:39:28

标签: linux postgresql centos rubygems

我在Linux(CentOS)系统中安装PG时遇到错误。

  

gem install pg

然后我收到了以下错误

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

并且对于解决方案我尝试了很多东西并安装了所需的包但仍然得到相同的错误。你可以看到我的loggres日志*

运行后

  

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

1 个答案:

答案 0 :(得分:0)

似乎你必须安装postgres头文件和库。 因为你的系统是RHEL试试这个。

yum install postgresql-devel

如果您正在使用postgres 9.4,那么

yum install postgresql94-devel

然后重新运行gem install pg'版本'