Skip to content
This repository was archived by the owner on Jan 23, 2019. It is now read-only.

gem install pg error #134

@mmahalwy

Description

@mmahalwy

When doing this manually it works, but from chef it results to this error. I noticed this happens in the other cookbook too but recently fixed.

* execute[bundle install for gems] action run

    ================================================================================
    Error executing action `run` on resource 'execute[bundle install for gems]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '1'
    ---- Begin output of gem install pg -v '0.18.1' ----
    STDOUT: Building native extensions.  This could take a while...
    STDERR: ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

        /opt/chef/embedded/bin/ruby -r ./siteconf20150121-22074-n5uw1p.rb 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.

    Provided configuration options:
        --with-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=/opt/chef/embedded/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}/lib
        --with-pqlib
        --without-pqlib
        --with-libpqlib
        --without-libpqlib
        --with-ms/libpqlib
        --without-ms/libpqlib

    extconf failed, exit code 1

    Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/pg-0.18.1 for inspection.
    Results logged to /opt/chef/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/pg-0.18.1/gem_make.out
    ---- End output of gem install pg -v '0.18.1' ----
    Ran gem install pg -v '0.18.1' returned 1

    Resource Declaration:
    ---------------------
    # In /root/chef-solo/cookbooks-3/main/recipes/backend.rb

     39: execute "bundle install for gems" do
     40:   cwd '/home/deployer/app'
     41:   command "gem install pg -v '0.18.1'"
     42: end
     43:

    Compiled Resource:
    ------------------
    # Declared in /root/chef-solo/cookbooks-3/main/recipes/backend.rb:39:in `from_file'

    execute("bundle install for gems") do
      action "run"
      retries 0
      retry_delay 2
      default_guard_interpreter :execute
      command "gem install pg -v '0.18.1'"
      backup 5
      cwd "/home/deployer/app"
      returns 0
      declared_type :execute
      cookbook_name :main
      recipe_name "backend"
    end


Running handlers:
[2015-01-21T04:17:28-05:00] ERROR: Running exception handlers
Running handlers complete
[2015-01-21T04:17:28-05:00] ERROR: Exception handlers complete
[2015-01-21T04:17:28-05:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 9 resources updated in 32.31227287 seconds
[2015-01-21T04:17:28-05:00] ERROR: execute[bundle install for gems] (main::backend line 39) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of gem install pg -v '0.18.1' ----
STDOUT: Building native extensions.  This could take a while...
STDERR: ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    /opt/chef/embedded/bin/ruby -r ./siteconf20150121-22074-n5uw1p.rb 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.

Provided configuration options:
    --with-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=/opt/chef/embedded/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}/lib
    --with-pqlib
    --without-pqlib
    --with-libpqlib
    --without-libpqlib
    --with-ms/libpqlib
    --without-ms/libpqlib

extconf failed, exit code 1

Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/pg-0.18.1 for inspection.
Results logged to /opt/chef/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/pg-0.18.1/gem_make.out
---- End output of gem install pg -v '0.18.1' ----
Ran gem install pg -v '0.18.1' returned 1
[2015-01-21T04:17:28-05:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
ERROR: RuntimeError: chef-solo failed. See output above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions