Bamboo and Rails - postgres bundle failing

Steven Rankin August 7, 2017

I using Bamboo with my ruby on rails app (Raisl 5 and ruby 2.3.3)

 

Bamboo does a 'build' of the app and runs the rpsec tests.  However, Bamboo fails when doing a gem install as it cannot seem to install postgres gem.

 

Here is the output from Bamboo:

 

ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

    current directory:

/atlassian_data/bamboo_home/xml-data/build-dir/APP-MRI20/vendor/bundle/ruby/2.4.0/gems/pg-0.21.0/ext
/home/lbfrg/.rvm/rubies/ruby-2.4.0/bin/ruby -r


checking for pg_config... yes
Using config values from /bin/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/lbfrg/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
        --with-pg
        --without-pg
        --enable-windows-cross
        --disable-windows-cross
        --with-pg-config
        --without-pg-config
        --with-pg_config
        --without-pg_config
        --with-pg-dir
        --without-pg-dir
        --with-pg-include
        --without-pg-include=${pg-dir}/include
        --with-pg-lib
        --without-pg-lib=${pg-dir}/

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/lbfrg/.rvm/gems/ruby-2.0.0-p353/extensions/x86_64-linux/2.0.0/pg-0.21.0/mkmf.log

extconf failed, exit code 1

 

How can I fix this?

1 answer

0 votes
somethingblue
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 8, 2017

Hi Steven,

The error you're getting shows that it can't find the 'libpq-fe.h header.  I would take a look at the StackOverflow article Can't find the 'libpq-fe.h header when trying to install pg gem or perhaps this Github page for more information on how to resolve this issue.

If neither of those resources help let me know what steps you tried and we'll go from there.

Cheers,

Branden

Steven Rankin August 9, 2017

Thanks for the reply.

 

The stackoverflow link you posted was my first port of call.

I added a bamboo bash script task and tried:

sudo apt-get install libpq-dev

but it gave me a tty error, it also would not work without sudo.  I'm not sure how to get it working with or without sudo, is that possible?

 

(I also tried using yum).

 

Do you know how I can get this to work in a Bamboo script task (before the bundle install)?  

 

Thanks

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events