Centos 7:确保`gem install pg -v'0.18.4'--source

问题描述 投票:0回答:1

试图通过Capistrano在生产中部署应用程序。

postgres版本是9.2.24

checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/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.5.1/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:

  /shared/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/pg-0.18.4/mkmf.log

尝试以下解决方案,但无济于事

  1. 尝试在生产服务器上进行手动安装
    sudo gem install pg -v 0.18.4
    
  2. Can't find the 'libpq-fe.h header when trying to install pg gem
  3. Error while installing json gem 'mkmf.rb can't find header files for ruby'
ruby-on-rails ruby postgresql rubygems capistrano
1个回答
0
投票

我认为您缺少某些库:

yum install postgresql-libs 
yum install postgresql-devel 

比安装宝石。

如果您使用其他软件包管理器,则与其一起安装。

© www.soinside.com 2019 - 2024. All rights reserved.