pg gem install fails saying version is too old?
Asked Answered
W

3

9

I am trying to install the pg (PostreSQL) gem for Ruby. I am receiving this error:

postgres/9.2-pgdg/bin/64/pg_config
Using config values from /location/to/install/postgres/9.2-pgdg/bin/64/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... yes
checking for PQconnectionUsedPassword()... no
Your PostgreSQL is too old. Either install an older version of this gem or upgrade your       database.
*** 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.

PostgreSQL version: postgres (PostgreSQL) 9.2.3

OS: solaris 10

I have also tried:

gem install pg  -- --with-pgsql-lib=/location/of/install/postgres/9.2-pgdg/lib/64/ --with-pg-config=/location/of/install/postgres/9.2-pgdg/bin/64/pg_config

I have no idea why this error is occurring and I cannot find any useful info on Google.

Any help is greatly appreciated.

Wedgwood answered 8/3, 2013 at 18:41 Comment(3)
i have multiple versions but i am pointing to the correct version also in mkmf.log I see the same error referencing the pQconnectionUsedPassword().Wedgwood
You may need to set PATH to make sure that the correct pg_config executable is first in the PATH, and set any LD_LIBRARY_PATH or Solaris equivalent environment vars to ensure the right libpq gets found.Handbook
What does the mkmf.log say in the section where it's checking for the presence of PQconnectionUsedPassword?Spoonerism
C
3

Lots of things can go wrong installing a database client, the gem and using it.

I generally install PostgreSQL from source, not from a distro. At that point I know I have all the source and know exactly where things got installed. That's important when installing the gem that talks to the client drivers.

I also rely on installing Ruby from source, either by directly installing it myself, or by using rbenv or RVM if it's on one of my development boxes. Then I also install the pg gem directly, using gem install pg; I've had too many bad experiences using distros when installing languages so I go old-school on it.

I wrote a little script I use on my Mac OS systems, that I've found useful for my CentOS Linux boxes:

#!/bin/sh -x

PATH=/Library/PostgreSQL/9.2/bin:$PATH
gem install pg

I adjust the PATH addition depending on where PostgreSQL got installed, and it seems to do the trick. I've used the longer, more "comprehensive" options also, but this seems to work as well.

The issue is that the installer needs to dig out installation information from the pg_config executable and being able to find pg_config does the trick.

Composition answered 18/11, 2013 at 16:39 Comment(1)
Can you please explain further on CentOS boxes? Are you running virtualization? I'm stuck trying to install gem install pg -v '0.20.0' but I have [email protected] installed with homebrew.Eisen
M
2

I was going nuts with this until I realized that postgresql-devel and postgresql-libs were from 8.1.23!!!

$ yum list installed postgres*
Loaded plugins: fastestmirror, security
Installed Packages
postgresql-devel.i386                           8.1.23-10.el5_10                       installed
postgresql-devel.x86_64                         8.1.23-10.el5_10                       installed
postgresql-libs.i386                            8.1.23-10.el5_10                       installed
postgresql-libs.x86_64                          8.1.23-10.el5_10                       installed

---------------

$ sudo yum install postgresql94-libs
$ sudo yum install postgresql94-devel

$ gem install pg
Successfully installed pg-0.18.1
Mutualize answered 2/2, 2015 at 18:17 Comment(0)
T
0

Installing and linking postgresql from homebrew fixed it for me:

brew install postgresql
brew unlink postgresql91
brew link --overwrite postgresql
Townie answered 23/1, 2018 at 20:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.