PostgreSQL gem for Ruby (pg) problem!

Hi there.

I’m having a problem here: I’m trying to install pg-0.7.9.2008.10.05
(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:
–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/bin/ruby
–with-pg-dir
–without-pg-dir
–with-pg-include
–without-pg-include=${pg-dir}/include
–with-pg-lib
–without-pg-lib=${pg-dir}/lib
–with-pqlib
–without-pqlib
–with-libpqlib
–without-libpqlib
–with-ms/libpqlib
–without-ms/libpqlib
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-0.7.9.2008.01.28, 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.

Hi,

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
package.