PostgreSQL gem for Ruby (pg) problem!

Hi there.

I’m having a problem here: I’m trying to install pg-
(The last version), but I get this…

PATH=/opt/PostgreSQL/8.3/bin:$PATH gem install pg
Building native extensions. This could take a while…
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb install pg
checking for main() in -lpq… no
checking for main() in -llibpq… no
checking for main() in -lms/libpq… no
*** 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:
Could not find PostgreSQL build environment (libraries & headers):
Makefile not created

It mentions 3 files missing as you can see, but that’s impossible,
because I installed PostgreSQL 8.3.4 via a Linux installer. What could
be wrong? The version I’m using now, ruby-pg-, can be
installed flawlessly and doesn’t give me any errors, but I’m worried
about the ActiveRecord support my gem doesn’t have and the latest
version does.

Can you help me? I’m working with a company in a project with Rails
2.1 and PostgreSQL 8.3.4. It’s urgent!!! Any ideas?

Greetings and thanks in advance.

Juan Escajadillo.


That’s how I installed the postgres gem on my Mac:

sugo gem install postgres – --with-pgsql-dir=/Library/PostgreSQL/8.3

Then in database.yml, specify the postgresql adapter.

Everything works perfectly on my side with PostgreSQL 8.3.4 binary