[chef] ruby-pg gem won't compile


Chronological Thread 
  • From: Marcelo de Moraes Serpa < >
  • To:
  • Subject: [chef] ruby-pg gem won't compile
  • Date: Fri, 23 Nov 2012 23:52:00 -0600

Hi list,

I've had some success with Chef (solo) so far, using knife-solo. I could already provision a server with nginx and a jekyll blog...

However, I got lost when it came to setup my rack app (padrino). I'm writing my own recipe, like I did with the jekyll one, and using a couple of other recipes for other components (postgres, runit, unicorn, application, application-ruby).

Everything goes well until I reach the point where bundle install tries to install the ruby-pg gem for the padrino app. It fails with:

Installing pg (0.14.1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /opt/chef/embedded/bin/ruby extconf.rb 
checking for pg_config... yes
Using config values from /usr/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 ***
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.

 I have libpq installed, but it just doesn't pick it up. I tried the chef-rvm cookbook (https://github.com/fnichol/chef-rvm), and tried to install rvm on the deploy user (I'm creating a deploy user that the app should be deploy on and ran from), but it also doesn't pick it up, and the gem_package monkeypatch, that is supposed to allow gems to be installed in the rvm ruby, fails.

I'm totally lost. Could someone shed some light on it? I'd be grateful!

Cheers,

- Marcelo.



Archive powered by MHonArc 2.6.16.

§