Ruby on Rails


17
Dec 11

Fixing pg Gem problem on Ubuntu 11.04

I’ve been getting errors relating to the pg gem when running

$ bundle install

on a RoR application I’ve been testing locally.

here’s the error:

Installing pg (0.11.0) with native
extensions /home/christian/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:551:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/home/christian/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
 checking for pg_config... no
 No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
 checking for libpq-fe.h... no
 Can't find the 'libpq-fe.h header
 *** 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=/home/christian/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
--with-pg
--without-pg
--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-pg-config
--without-pg-config
--with-pg_config
--without-pg_config

To fix, I ran the following:

$ sudo aptitude install 1ibpq-dev

followed by:

$ gem install pg

I can now bundle the application successfully.


23
Oct 11

The Ruby Show

Just subscribed to The Ruby Show podcast, presented by Jaison Seifer and ‘Beginning Ruby’ author Peter Cooper.  Nicely presented and well worth a listen.