0

I've been all over trying all sorts of solutions so I'd appreciate any help.

I have the following PostgreSQL items installed:

postgresql96.x86_64 - 9.6.12-1PGDG.rhel6
postgresql96-devel.x86_64 - 9.6.12-1PGDG.rhel6
postgresql96-libs.x86_64 - 9.6.12-1PGDG.rhel6
postgresql96-server.x86_64 - 9.6.12-1PGDG.rhel6

When I run bundle install, I get the following error:

Installing pg 1.1.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: 
/home/admin/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/pg-1.1.4/ext
/home/admin/.rbenv/versions/2.6.1/bin/ruby -I 
/home/admin/.rbenv/versions/2.6.1/lib/ruby/2.6.0 -r ./siteconf20190502-8579-10nqtt0.rb extconf.rb
--with-pg-config\=/opt/local/lib/postgresql91/bin/pg_config
Using config values from /opt/local/lib/postgresql91/bin/pg_config
sh: /opt/local/lib/postgresql91/bin/pg_config: No such file or directory
sh: /opt/local/lib/postgresql91/bin/pg_config: No such file or directory
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.

A large majority of the guides say that we need to install the devel and libs packages but they are already installed. I am using CentOS 6.

Thanks!

Also I should add that I'm using yum as my package manager, thanks.

M. Rose
  • 3
  • 4
  • Have you tried `gem install pg -v 1.1.4` yet and see if the same error shows up? Also, you might `bundle config build.pg --with-pg-config=/opt/local/lib/postgresql91/bin/pg_config` after confirming that your pg_config actually lives there – Jay Dorsey May 02 '19 at 18:51

2 Answers2

0

I am pretty sure you need the postgres client tools also... when compiling postgres on the server. You should install the devel packages for postgres server and the command line tools.

0

Looks like for CentOS libpq-fe.h header comes with postgresql-devel:

yum install postgresql-devel

Ref https://stackoverflow.com/a/6040822/4950680

Martin
  • 4,042
  • 2
  • 19
  • 29