Forum: Ruby on Rails PostgreSQL gem for Ruby (pg) problem!

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ed3050ec0a96c03ef1304e7ad1ff46fb?d=identicon&s=25 The Neurochild (Guest)
on 2008-10-10 20:39
(Received via mailing list)
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.
059ed46172a087063ce26250e44c8627?d=identicon&s=25 Fernando Perez (fernando)
on 2008-10-19 14:22
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.
This topic is locked and can not be replied to.