Re: pg gem and ruby app deployment issues

John Shahid

Hi Evgeniy,

Are you using a customized stack with that cloudfdoundry deployment. I’m
looking at cflinuxfs2 stack/rootfs and libpq-dev has been there for a while
now. This package has provided pg_config since version 9.3.4

Another (unlikely) possiblity, have you set --with-pg-config locally? If
you had there would be a .bundle/config inside your app with similar
contents as below:

BUNDLE_BUILD__PG: "--with-pg-config=/usr/pgsql-9.1/bin/pg_config"

On Fri, Apr 22, 2016 at 5:44 AM Evgeniy Litvinenko mirakl577(a)
<http://mailto:mirakl577(a)> wrote:

Good day,

We have ruby application which requires gem 'pg' for connection to
postgres db, for some reason I can't deploy it, it fails on bundle install
phase, I used different ruby buildpacks and ruby versions but without any
luck, our cf version is 212.

source ""

ruby '2.3.0'
gem "sinatra", "~> 1.4.3"
gem 'json'
gem 'rest-client'
gem 'pg'

Cloning into '/tmp/buildpacks/ruby-buildpack'...
Submodule 'compile-extensions' ( registered for path
Cloning into 'compile-extensions'...
Submodule path 'compile-extensions': checked out
-------> Buildpack version 1.6.16
Downloaded [
-----> Compiling Ruby/Rack
Downloaded [
-----> Using Ruby version: ruby-2.3.0
-----> Installing dependencies using bundler 1.11.2
Downloaded [
Running: bundle install --without development:test --path
vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Fetching gem metadata from
Fetching version metadata from
Using json 1.8.3
Installing netrc 0.11.0
Installing unf_ext with native extensions
Installing mime-types 2.99.1
Installing pg 0.18.4 with native extensions
Installing rack 1.6.4
Installing tilt 2.0.2
Using bundler 1.11.2
Installing rack-protection 1.5.3
Installing sinatra 1.4.7
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/tmp/staged/app/vendor/ruby-2.3.0/bin/ruby -r
./siteconf20160422-297-z2ly6c.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***

Join to automatically receive all group messages.