3

I have:

  • Ubuntu 11.10
  • Postgres 8.4
  • libpq-dev, build-essential installed
  • ruby 1.9.2 and rails 3.2.1 install via rvm

However, pg gem fails to build, saying that:

checking for pg_config... yes
Using config values from /usr/lib/postgresql/8.4/bin/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... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***

I understant that this problem was asked dozen of times, but I googled like 2 days, and tried all the solutions I encoutered, and still this gem fails to build.

Any ideas?

UncleLaz
  • 11,903
  • 2
  • 16
  • 11
  • Is `libpq-dev` installed in an unusual location (eg not `/usr/lib` or `/usr/local/lib`)? If so, there should be an option that you can toggle in `configure.sh`. –  Feb 13 '12 at 11:36
  • nope, the library is located in /usr/lib – UncleLaz Feb 15 '12 at 13:53

1 Answers1

1

Today I encountered a very similar problem on an Ubuntu 10.04. After trying to get the pg installed for half a day, I decided to just install a more recent version of postgresql manually - which solved the problem for me.

Here is what I did:

1) Obtain the postgresql sources from their website. Since I deploy my rails applications to heroku and they say that they use version 9.0 of postgresql atm, I downloaded

http://ftp.postgresql.org/pub/source/v9.0.6/postgresql-9.0.6.tar.gz

2) Unpack, then follow the instructions in the INSTALL file. Note that 'su' is to be replaced by 'sudo su' in Ubuntu. After that, you have a postgresql server installed at /usr/local/pgsql/.

3) If you already had a system user named 'postgres', you might want to change its home directory to the new postgres installation. And you might want to add /usr/local/pgsql/bin to your PATH. Maybe uninstalling the postgresql-8.4 through apt-get before installing the 9.0 version from sources would be a good idea, I did not try that.

hth

Raffael
  • 2,639
  • 16
  • 15