Giter Club home page Giter Club logo

Comments (93)

vitalis avatar vitalis commented on September 5, 2024 2

The solution is:
In the cookbook where you include the postgresql::ruby recipe add following at the top:

node.default['build-essential']['compile_time'] = true
include_recipe 'build-essential'

from postgresql.

sfroehler avatar sfroehler commented on September 5, 2024 1

I'm still seeing the issue, two.
ubuntu 14.04 and 12.04
chef 12.0.3
postgresql cookbok 3.4.16

Recipe: postgresql::ruby
* chef_gem[pg] action install

  ================================================================================
  Error executing action `install` on resource 'chef_gem[pg]'
  ================================================================================

  Mixlib::ShellOut::ShellCommandFailed
  ------------------------------------
  Expected process to exit with [0], but received '1'
  ---- Begin output of /opt/chef/embedded/bin/gem install pg -q --no-rdoc --no-ri -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 ./siteconf20150224-10329-1i77ti5.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 /opt/chef/embedded/bin/gem install pg -q --no-rdoc --no-ri -v "0.18.1" ----
  Ran /opt/chef/embedded/bin/gem install pg -q --no-rdoc --no-ri -v "0.18.1" returned 1

  Cookbook Trace:
  ---------------
  /var/chef/cache/cookbooks/postgresql/recipes/ruby.rb:57:in `rescue in from_file'
  /var/chef/cache/cookbooks/postgresql/recipes/ruby.rb:23:in `from_file'
  /var/chef/cache/cookbooks/shipcloud_app/recipes/default.rb:112:in `from_file'

  Resource Declaration:
  ---------------------
  # In /var/chef/cache/cookbooks/postgresql/recipes/ruby.rb

   57:     chef_gem "pg"
   58:   rescue Gem::Installer::ExtensionBuildError, Mixlib::ShellOut::ShellCommandFailed => e

  Compiled Resource:
  ------------------
  # Declared in /var/chef/cache/cookbooks/postgresql/recipes/ruby.rb:57:in `rescue in from_file'

  chef_gem("pg") do
    action :install
    retries 0
    retry_delay 2
    default_guard_interpreter :default
    package_name "pg"
    version "0.18.1"
    timeout 900
    gem_binary "/opt/chef/embedded/bin/gem"
    declared_type :chef_gem
    cookbook_name "postgresql"
    recipe_name "ruby"
  end

 [2015-02-24T14:30:25+00:00] WARN: Failed to properly build pg gem. Forcing properly linking and retrying (omnibus fix)
* execute[generate pg gem Makefile] action run
  - execute PATH=$PATH:/usr/pgsql-9.3/bin /opt/chef/embedded/bin/ruby extconf.rb
* execute[make pg gem lib] action run

  ================================================================================
  Error executing action `run` on resource 'execute[make pg gem lib]'
  ================================================================================

  Errno::ENOENT
  -------------
  No such file or directory - make

  Cookbook Trace:
  ---------------
  /var/chef/cache/cookbooks/postgresql/recipes/ruby.rb:101:in `rescue in rescue in from_file'
  /var/chef/cache/cookbooks/postgresql/recipes/ruby.rb:56:in `rescue in from_file'
  /var/chef/cache/cookbooks/postgresql/recipes/ruby.rb:23:in `from_file'
  /var/chef/cache/cookbooks/shipcloud_app/recipes/default.rb:112:in `from_file'

  Resource Declaration:
  ---------------------
  # In /var/chef/cache/cookbooks/postgresql/recipes/ruby.rb

   96:     lib_maker = execute 'make pg gem lib' do
   97:       command 'make'
   98:       cwd ext_dir
   99:       action :nothing
  100:     end
  101:     lib_maker.run_action(:run)

  Compiled Resource:
  ------------------
  # Declared in /var/chef/cache/cookbooks/postgresql/recipes/ruby.rb:96:in `rescue in rescue in from_file'

  execute("make pg gem lib") do
    action [:nothing]
    retries 0
    retry_delay 2
    default_guard_interpreter :execute
    command "make"
    backup 5
    cwd "/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/pg-0.18.1/ext"
    returns 0
    declared_type :execute
    cookbook_name "postgresql"
    recipe_name "ruby"
  end


================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/shipcloud_app/recipes/default.rb
================================================================================

Errno::ENOENT
-------------
execute[make pg gem lib] (postgresql::ruby line 96) had an error: Errno::ENOENT: No such file or directory - make

Cookbook Trace:
---------------
  /var/chef/cache/cookbooks/postgresql/recipes/ruby.rb:101:in `rescue in rescue in from_file'
  /var/chef/cache/cookbooks/postgresql/recipes/ruby.rb:56:in `rescue in from_file'
  /var/chef/cache/cookbooks/postgresql/recipes/ruby.rb:23:in `from_file'
  /var/chef/cache/cookbooks/shipcloud_app/recipes/default.rb:112:in `from_file'

Relevant File Content:
----------------------
/var/chef/cache/cookbooks/postgresql/recipes/ruby.rb:

 94:      lib_builder.run_action(:run)
 95:
 96:      lib_maker = execute 'make pg gem lib' do
 97:        command 'make'
 98:        cwd ext_dir
 99:        action :nothing
100:      end
101>>     lib_maker.run_action(:run)
102:
103:      lib_installer = execute 'install pg gem lib' do
104:        command 'make install'
105:        cwd ext_dir
106:        action :nothing
107:      end
108:      lib_installer.run_action(:run)
109:
110:      spec_installer = execute 'install pg spec' do


Running handlers:
 [2015-02-24T14:30:30+00:00] ERROR: Running exception handlers
Running handlers complete
 [2015-02-24T14:30:30+00:00] ERROR: Exception handlers complete
 [2015-02-24T14:30:30+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out

/opt/chef/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/pg-0.18.1/mkmf.log:
http://pastebin.com/dQMgyHGP

from postgresql.

hulu1522 avatar hulu1522 commented on September 5, 2024

Same here...

Somewhere something has changed with the embedded ruby in chef-12.0.0 and causes the whole thing to fail.

Here in the postgresql::ruby the check for omnibus is successful:
https://github.com/hw-cookbooks/postgresql/blob/develop/recipes/ruby.rb#L58
[2014-12-06T00:11:09+00:00] WARN: [["chef"]]

When it tries to do the omnibus fix it fails:

  [2014-12-06T00:11:09+00:00] WARN: Failed to properly build pg gem. Forcing properly linking and retrying (omnibus fix)
  * execute[generate pg gem Makefile] action run       [2014-12-06T00:11:09+00:00] INFO: Processing execute[generate pg gem Makefile] action run (postgresql::ruby line 86)
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
        --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

    ================================================================================
    Error executing action `run` on resource 'execute[generate pg gem Makefile]'
    ================================================================================

Sorry for this set back but this is a major issue unless people lock their chef version.

EDIT:
I also heard somewhere that chef-12.0.0 deprecated something to do with paths which might explain why this is failing: https://github.com/hw-cookbooks/postgresql/blob/develop/recipes/ruby.rb#L88

EDIT 2:
This is what I got according to the issue reported with chef (chef/chef#2545) but once I implement the change it fails to find generate in the command:

    lib_builder = execute 'generate pg gem Makefile' do
      # [COOK-3490] pg gem install requires full path on RHEL
      environment "PATH" => "#{ENV['PATH']}:/usr/pgsql-#{node['postgresql']['version']}/bin #{RbConfig.ruby} extconf.rb"
      cwd ext_dir
      action :nothing
    end
    lib_builder.run_action(:run)

from postgresql.

jtimberman avatar jtimberman commented on September 5, 2024

As I explained, this is not due to the removal of the path attribute as the postgresql::source recipe doesn't use that at all.

Digging into this, I was able to reproduce the build failure. The mkmf.log has these errors:

conftest.c: In function ‘t’:
conftest.c:15:1: error: too few arguments to function ‘PQconnectdb’
 int t(void) { PQconnectdb(); return 0; }
 ^
In file included from conftest.c:3:0:
/usr/include/postgresql/libpq-fe.h:250:16: note: declared here
 extern PGconn *PQconnectdb(const char *conninfo);
                ^
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: #include <libpq-fe.h>
 4:
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { PQconnectdb(); return 0; }
/* end */

And later,

/usr/bin/ld: cannot find -llibpq
collect2: error: ld returned 1 exit status

These errors are repeated a couple times, I'm sure if you look at mkmf.log on your system (/opt/chef/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/pg-0.17.1/mkmf.log), you'll see similar issues.

Running chef 11.16.4 using the omnibus package worked, and I believe it's because that version uses Ruby 1.9.3. Compare Chef 11.16.4's embedded ruby:

vagrant@ruby-ubuntu-1404:~$ /opt/chef/embedded/bin/ruby --version
ruby 1.9.3p547 (2014-05-14 revision 45962) [x86_64-linux]

Versus Chef 12.0.0's:

vagrant@ruby-ubuntu-1404:~$ /opt/chef/embedded/bin/ruby --version
ruby 2.1.4p265 (2014-10-27 revision 48166) [x86_64-linux]

The requirements of the pg RubyGem mentions:

  • Ruby 1.9.3-p392, or 2.0.0-p0.

It's possible it hasn't been tested, and may not work, on Ruby 2.1.0+.

from postgresql.

mshappe avatar mshappe commented on September 5, 2024

The PG gem works fine with Ruby 2.1.2 -- I use it all the time.

It just doesn't work with Chef for some bizarre reason. I just ran into this, myself.

from postgresql.

dpresling avatar dpresling commented on September 5, 2024

Same issue here.

from postgresql.

mshappe avatar mshappe commented on September 5, 2024

Similar to the OP, I was able to work around it in .kitchen.yml by forcing Chef Omnibus back to 11.16.4:

driver:
  name: vagrant
  require_chef_omnibus: 11.16.4

Of course, that ONLY works for kitchen and not for, say, knife bootstrap.

One way or the other, moral of the story is to pin your versions...

While I haven't tried it, it's also possible that the issue could be worked around the "long way", for people who really need 12, by dropping the omnibus altogether and instead installing chef as a gem in sequence with others. I remember seeing this as an alternative while googling around. As a relative newbie, though, I don't much like the idea. The Omnibus is a good idea. It's just breaking stuff, here...

from postgresql.

lamont-granquist avatar lamont-granquist commented on September 5, 2024

It seems like this is pretty clear about what the problem is:

       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)

So what is responsible for installing the pg libs and where are they and why can't extconf.rb find them?

from postgresql.

mshappe avatar mshappe commented on September 5, 2024

What it seems like and what it is are two different universes :-)

The library is installed. I checked. /usr/lib/libpq.{a,so}* are all present. nm /usr/lib/libpq.a shows the "missing" symbol.

Also, this works fine with the 11.16.4 omnibus.

from postgresql.

jdstuart avatar jdstuart commented on September 5, 2024

This is the same as chef/chef#2587. Where's the problem. Should the recipe be fixed, or is it a bug in Chef?

from postgresql.

lamont-granquist avatar lamont-granquist commented on September 5, 2024

What is the complete output of mkmf.log?

from postgresql.

mshappe avatar mshappe commented on September 5, 2024

@lamont-granquist I'll unpin and reconverge and let you know in a little while. I do remember that the error didn't really seem to make a lot of sense, though 😄

from postgresql.

lamont-granquist avatar lamont-granquist commented on September 5, 2024

Yeah mkmf.log never makes any sense, part of the reason why I need to see the whole thing in context...

from postgresql.

mshappe avatar mshappe commented on September 5, 2024
find_executable: checking for pg_config... -------------------- yes

--------------------

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/usr/include/postgresql  -I/opt/chef/embedded/include   -I/opt/chef/embedded/include -O3 -g -pipe -fPIC conftest.c  -L. -L/opt/chef/embedded/lib -L/usr/lib -L/opt/chef/embedded/lib -L.  -fstack-protector -L/opt/chef/embedded/lib -rdynamic  -L/opt/chef/embedded/lib          -L/opt/chef/embedded/lib -lruby  -lpthread -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/usr/include/postgresql  -I/opt/chef/embedded/include   -I/opt/chef/embedded/include -O3 -g -pipe -fPIC conftest.c  -L. -L/opt/chef/embedded/lib -L/usr/lib -L/opt/chef/embedded/lib -L.  -fstack-protector -L/opt/chef/embedded/lib -rdynamic  -L/opt/chef/embedded/lib          -L/opt/chef/embedded/lib -lruby  -Wl,-rpath,/usr/lib -lpthread -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main() {return 0;}
/* end */

find_header: checking for libpq-fe.h... -------------------- yes

"gcc -E -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/usr/include/postgresql  -I/opt/chef/embedded/include   -I/opt/chef/embedded/include -O3 -g -pipe -fPIC  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <libpq-fe.h>
/* end */

--------------------

find_header: checking for libpq/libpq-fs.h... -------------------- yes

"gcc -E -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/usr/include/postgresql  -I/opt/chef/embedded/include   -I/opt/chef/embedded/include -O3 -g -pipe -fPIC  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <libpq/libpq-fs.h>
/* end */

--------------------

find_header: checking for pg_config_manual.h... -------------------- yes

"gcc -E -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/usr/include/postgresql  -I/opt/chef/embedded/include   -I/opt/chef/embedded/include -O3 -g -pipe -fPIC  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <pg_config_manual.h>
/* end */

--------------------

have_library: checking for PQconnectdb() in -lpq... -------------------- no

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/usr/include/postgresql  -I/opt/chef/embedded/include   -I/opt/chef/embedded/include -O3 -g -pipe -fPIC conftest.c  -L. -L/opt/chef/embedded/lib -L/usr/lib -L/opt/chef/embedded/lib -L.  -fstack-protector -L/opt/chef/embedded/lib -rdynamic  -L/opt/chef/embedded/lib    -Wl,-rpath,/usr/lib       -L/opt/chef/embedded/lib -lruby -lpq  -lpthread -ldl -lcrypt -lm   -lc"
/usr/lib/libpq.so: undefined reference to `SSL_CTX_use_certificate_chain_file@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_write@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_set_fd@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_use_PrivateKey_file@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `CRYPTO_set_locking_callback@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_NAME_get_text_by_NID@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_connect@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_init@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_STORE_load_locations@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_get_cert_store@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_ctrl@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_free@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_library_init@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_ctrl@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ERR_get_error@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_pending@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_free@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_get_subject_name@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_use_certificate_file@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_check_private_key@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_load_error_strings@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_by_id@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_get_peer_certificate@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_new@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `CRYPTO_num_locks@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_load_private_key@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_finish@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_set_verify@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_free@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `CRYPTO_set_id_callback@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_get_error@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_new@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_shutdown@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_use_PrivateKey@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `TLSv1_method@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_STORE_set_flags@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_read@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `OPENSSL_config@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_load_verify_locations@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ERR_reason_error_string@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_set_ex_data@OPENSSL_1.0.0'
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <libpq-fe.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12: 
13:   return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return 0; }
/* end */

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/usr/include/postgresql  -I/opt/chef/embedded/include   -I/opt/chef/embedded/include -O3 -g -pipe -fPIC conftest.c  -L. -L/opt/chef/embedded/lib -L/usr/lib -L/opt/chef/embedded/lib -L.  -fstack-protector -L/opt/chef/embedded/lib -rdynamic  -L/opt/chef/embedded/lib    -Wl,-rpath,/usr/lib       -L/opt/chef/embedded/lib -lruby -lpq  -lpthread -ldl -lcrypt -lm   -lc"
conftest.c: In function ‘t’:
conftest.c:15:1: error: too few arguments to function ‘PQconnectdb’
 int t(void) { PQconnectdb(); return 0; }
 ^
In file included from conftest.c:3:0:
/usr/include/postgresql/libpq-fe.h:250:16: note: declared here
 extern PGconn *PQconnectdb(const char *conninfo);
                ^
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <libpq-fe.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12: 
13:   return 0;
14: }
15: int t(void) { PQconnectdb(); return 0; }
/* end */

--------------------

have_library: checking for PQconnectdb() in -llibpq... -------------------- no

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/usr/include/postgresql  -I/opt/chef/embedded/include   -I/opt/chef/embedded/include -O3 -g -pipe -fPIC conftest.c  -L. -L/opt/chef/embedded/lib -L/usr/lib -L/opt/chef/embedded/lib -L.  -fstack-protector -L/opt/chef/embedded/lib -rdynamic  -L/opt/chef/embedded/lib    -Wl,-rpath,/usr/lib       -L/opt/chef/embedded/lib -lruby -llibpq  -lpthread -ldl -lcrypt -lm   -lc"
/usr/bin/ld: cannot find -llibpq
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <libpq-fe.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12: 
13:   return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return 0; }
/* end */

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/usr/include/postgresql  -I/opt/chef/embedded/include   -I/opt/chef/embedded/include -O3 -g -pipe -fPIC conftest.c  -L. -L/opt/chef/embedded/lib -L/usr/lib -L/opt/chef/embedded/lib -L.  -fstack-protector -L/opt/chef/embedded/lib -rdynamic  -L/opt/chef/embedded/lib    -Wl,-rpath,/usr/lib       -L/opt/chef/embedded/lib -lruby -llibpq  -lpthread -ldl -lcrypt -lm   -lc"
conftest.c: In function ‘t’:
conftest.c:15:1: error: too few arguments to function ‘PQconnectdb’
 int t(void) { PQconnectdb(); return 0; }
 ^
In file included from conftest.c:3:0:
/usr/include/postgresql/libpq-fe.h:250:16: note: declared here
 extern PGconn *PQconnectdb(const char *conninfo);
                ^
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <libpq-fe.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12: 
13:   return 0;
14: }
15: int t(void) { PQconnectdb(); return 0; }
/* end */

--------------------

have_library: checking for PQconnectdb() in -lms/libpq... -------------------- no

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/usr/include/postgresql  -I/opt/chef/embedded/include   -I/opt/chef/embedded/include -O3 -g -pipe -fPIC conftest.c  -L. -L/opt/chef/embedded/lib -L/usr/lib -L/opt/chef/embedded/lib -L.  -fstack-protector -L/opt/chef/embedded/lib -rdynamic  -L/opt/chef/embedded/lib    -Wl,-rpath,/usr/lib       -L/opt/chef/embedded/lib -lruby -lms/libpq  -lpthread -ldl -lcrypt -lm   -lc"
/usr/bin/ld: cannot find -lms/libpq
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <libpq-fe.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12: 
13:   return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return 0; }
/* end */

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/usr/include/postgresql  -I/opt/chef/embedded/include   -I/opt/chef/embedded/include -O3 -g -pipe -fPIC conftest.c  -L. -L/opt/chef/embedded/lib -L/usr/lib -L/opt/chef/embedded/lib -L.  -fstack-protector -L/opt/chef/embedded/lib -rdynamic  -L/opt/chef/embedded/lib    -Wl,-rpath,/usr/lib       -L/opt/chef/embedded/lib -lruby -lms/libpq  -lpthread -ldl -lcrypt -lm   -lc"
conftest.c: In function ‘t’:
conftest.c:15:1: error: too few arguments to function ‘PQconnectdb’
 int t(void) { PQconnectdb(); return 0; }
 ^
In file included from conftest.c:3:0:
/usr/include/postgresql/libpq-fe.h:250:16: note: declared here
 extern PGconn *PQconnectdb(const char *conninfo);
                ^
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <libpq-fe.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12: 
13:   return 0;
14: }
15: int t(void) { PQconnectdb(); return 0; }
/* end */

--------------------

from postgresql.

hulu1522 avatar hulu1522 commented on September 5, 2024

Here is a link to my mkmf.log also:
http://pastebin.com/P600g6p4

from postgresql.

lamont-granquist avatar lamont-granquist commented on September 5, 2024

So its most likely this one I think:

have_library: checking for PQconnectdb() in -lpq... -------------------- no

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/usr/include/postgresql  -I/opt/chef/embedded/include   -I/opt/chef/embedded/include -O3 -g -pipe -fPIC conftest.c  -L. -L/opt/chef/embedded/lib -L/usr/lib -L/opt/chef/embedded/lib -L.  -fstack-protector -L/opt/chef/embedded/lib -rdynamic  -L/opt/chef/embedded/lib    -Wl,-rpath,/usr/lib       -L/opt/chef/embedded/lib -lruby -lpq  -lpthread -ldl -lcrypt -lm   -lc"
/usr/lib/libpq.so: undefined reference to `SSL_CTX_use_certificate_chain_file@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_write@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_set_fd@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_use_PrivateKey_file@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `CRYPTO_set_locking_callback@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_NAME_get_text_by_NID@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_connect@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_init@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_STORE_load_locations@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_get_cert_store@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_ctrl@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_free@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_library_init@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_ctrl@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ERR_get_error@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_pending@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_free@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_get_subject_name@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_use_certificate_file@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_check_private_key@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_load_error_strings@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_by_id@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_get_peer_certificate@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_new@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `CRYPTO_num_locks@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_load_private_key@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_finish@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_set_verify@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_free@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `CRYPTO_set_id_callback@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_get_error@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_new@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_shutdown@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_use_PrivateKey@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `TLSv1_method@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_STORE_set_flags@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_read@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `OPENSSL_config@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_load_verify_locations@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ERR_reason_error_string@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_set_ex_data@OPENSSL_1.0.0'
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <libpq-fe.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12: 
13:   return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return 0; }
/* end */

A lot of the tests aren't relevant, we need to look only at the -lpq ones, and most of the other ones blow up in the parser as ruby steps through different C syntaxes. This one parsed and compiled but failed to link. It looks like we're getting a conflict between the embedded openssl and the system one. Not sure how solvable that is, because ruby needs to load the openssl from embedded, but if the system libpg can't link against that one, you just can't load that into the same C process.

This smells like a resurrection of the old problem we had with this cookbook, details have paged out of my brain but there's a COOK ticket somewhere.

from postgresql.

hulu1522 avatar hulu1522 commented on September 5, 2024

Don't know if this is needed but I thought I would post a link to the successful build mkmf.log file when using Chef 11.16.4 and it's ruby 1.9.1

http://pastebin.com/HxFAAa51

from postgresql.

lamont-granquist avatar lamont-granquist commented on September 5, 2024

Yeah @hulu1522 that's useful, here's the same test, passing:

have_library: checking for PQconnectdb() in -lpq... -------------------- yes

"gcc -o conftest -I/opt/chef/embedded/include/ruby-1.9.1/x86_64-linux -I/opt/chef/embedded/include/ruby-1.9.1/ruby/backward -I/opt/chef/embedded/include/ruby-1.9.1 -I. -I/usr/include/postgresql    -I/opt/chef/embedded/include -I/opt/chef/embedded/include -O3 -g -pipe -fPIC conftest.c  -L. -L/opt/chef/embedded/lib -L/usr/lib -L/opt/chef/embedded/lib -L.  -L/opt/chef/embedded/lib -rdynamic  -L/opt/chef/embedded/lib    -Wl,-rpath,/usr/lib       -L/opt/chef/embedded/lib -lruby -lpq  -lpthread -lrt -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: #include <libpq-fe.h>
 4:
 5: /*top*/
 6: int t() { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return 0; }
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
/* end */

--------------------

wonder if this is related to the LIBPATH stuff in mkmf.rb that trolled AIX builds so hard...

from postgresql.

mshappe avatar mshappe commented on September 5, 2024

@lamont-granquist This absolutely looks like a resurrection of the old issue that turned out to be incompatible SSL libraries or something bizarre like that. I was at first really crabby because I assumed it was that issue and it still wasn't fixed, but pinning back to 11.16.4 suggests instead that this is a case of the issue being a hydra :-)

from postgresql.

lamont-granquist avatar lamont-granquist commented on September 5, 2024

Yeah, I think it may be ruby 2.1 did some changes that re-introduced the problem. Wouldn't show up on normal non-omnibus-chef pg-gem on ruby 2.1.

And, the two gcc compile lines only differ by the new one having -fstack-protector added, which shouldn't have anything to do with this problem.

from postgresql.

lamont-granquist avatar lamont-granquist commented on September 5, 2024

Try editing /opt/chef/embedded/lib/ruby/2.1.0/x86_64-linux/rbconfig.rb, and delete this line:

  CONFIG["LIBPATHENV"] = "LD_LIBRARY_PATH"

(or whatever its set to, but its probably set to that on linuxen)

from postgresql.

lamont-granquist avatar lamont-granquist commented on September 5, 2024

We ship openssl 1.0.1j in chef-11 as well so that didn't change.

from postgresql.

mshappe avatar mshappe commented on September 5, 2024

Hey, I didn't say any of this actually made sense :-)

I've had other fish to fry this afternoon, but I'll try the above rbconfig.rb thing when I can.

from postgresql.

mshappe avatar mshappe commented on September 5, 2024

That solution works. Of course, that's not a practical solution for actually using, say, knife solo in an automatic way going forward, but it did make things work.

Full procedure:

  • ran knife solo bootstrap... and let it fail.
  • vagrant ssh and fix up the file as suggested above
  • knife solo cook... and it succeeded.

from postgresql.

lamont-granquist avatar lamont-granquist commented on September 5, 2024

Heh,yeah, so we can work on ripping that out of the base ruby that we ship. I knew about that issue offhand because it already trolled us hard when we were building omnibus chef on AIX, so we already have some workarounds that we can just apply on every platform.

from postgresql.

mshappe avatar mshappe commented on September 5, 2024

...AIX... You are brave! 😄

from postgresql.

lamont-granquist avatar lamont-granquist commented on September 5, 2024

HAHAHAHAHAHAHAHHAHAHA, luckily for me we hired some other sucker to take it over (@scotthain), but i still wind up learning more than i ever wanted to about it...

from postgresql.

scotthain avatar scotthain commented on September 5, 2024

I don't know what you're talking about @lamont-granquist ;)

from postgresql.

hulu1522 avatar hulu1522 commented on September 5, 2024

For those using Test-Kitchen this is a TEMP work around until the fix is merged:

fix = Chef::Util::FileEdit.new("/opt/chef/embedded/lib/ruby/2.1.0/x86_64-linux/rbconfig.rb")

fix.search_file_delete_line("^.*LIBPATHENV.*$")

fix.write_file

Just put it in your recipe.

from postgresql.

mshappe avatar mshappe commented on September 5, 2024

As workarounds go, that's not terrible, but it would be nice if the issue itself did not keep rearing its head every time a version changes! 😄 (I know, I'm demanding!)

from postgresql.

lamont-granquist avatar lamont-granquist commented on September 5, 2024

Well, in this case ruby 2.x trolled us hard here, and its a use case that will only affect this stuff.

We're talking about pull more stuff into core chef, and shipping omnibus-chef with libpg and libmysql that was integrated would be one thing we could do to make this issue really go away, but we haven't done that in the past since theoretically users should be using the client libs that match the server libs they have in production. Although the APIs for what we need to do (create users and tables and things) may be stable enough that's not a concern in practice?

from postgresql.

mshappe avatar mshappe commented on September 5, 2024

I don't think including more libraries is the way to go, personally, but then I'm already a bit surprised at how much the omnibus contains!

I'll grant you that a change of Rubies can be a big deal, but I'll also point out that 2.1.x is old news, by now. A change to it was overdue 😄

from postgresql.

mshappe avatar mshappe commented on September 5, 2024

Out of curiosity, if I wanted to skip the omnibus entirely (I don't necessarily, but if...), are there good resources out there for bootstrapping without it?

from postgresql.

lamont-granquist avatar lamont-granquist commented on September 5, 2024

Well, yeah, but 11.x was stuck on 1.9.x because of SemVer considerations, and the time between 11 and 12 was 18+ months. I'd like to be able to either bump the ruby in a minor version if its given a lot of announcement or else to be able to release major versions more often, but releasing more often would have led us to maintaining more major branches and backports because we've had customers stuck on 10.x.

from postgresql.

jtimberman avatar jtimberman commented on September 5, 2024

I think that for implementing Chef resources for managing things in postgresql, shelling out is probably a more maintainable plan long term. There may be changes in the way the CLI tools work between major releases, but I think those are probably rare for most use cases.

I think if including these database libraries in Chef is a thing, we should have an RFC for that.

from postgresql.

mshappe avatar mshappe commented on September 5, 2024

Ah. THAT makes sense -- thank you for explaining it. I'm still a bit of a newb for Chef (that's probably obvious, I'm afraid), so I didn't realize how long it had been between major version bumps! I'm basically coming in right on the cusp of 11.16 -> 12.0...

from postgresql.

lamont-granquist avatar lamont-granquist commented on September 5, 2024

Bootstrapping without omnibus generally isn't recommended. You buy yourself all the costs of tracking whatever ruby version that we're using. If you wind up stuck on an old version of ruby (lets say you deployed ruby 2.0.0 with gem installed chef at some point) and now we're shipping ruby 2.1.5 then if you find a bug in your ruby 2.0.0 that we can't replicate on ruby 2.1.5 you're going to drop down our priority list to "PRs accepted!" level.

Every week or two we get a customer complaint with a backtrace in it that I can see from the version numbers that its on some shitty gem install of 1.8.7 and even when we were on chef 11 and were rspec testing on 1.8.7 and couldn't get around to dropping support of that, I'd just read the number in the backtrace, tell the user to check out omnibus and move on from the ticket.

But, I mean I test myself with bundle installed chef-client in my own rvm-managed ruby all the time, but I'm bumping to stay ahead of the curve and find bugs in new versions, and I'm using rvm so that I can backtrace to older versions of ruby (that we still have to support in some cases) in order to test bugs there. It requires a higher level of knowledge and maintenance. Before going down that road in production you have to ask how often you'll be able to bump the ruby that chef executes against in prod as we bump omnibus ruby.

And the distro rubies are often terrible -- although more so in the past with segfaulty garbage on rhel5 and rhel6 rubies. Still, if you've got a distro ruby that segfaults and it doesn't replicate on omnibus-chef we're unlikely to help since digging into segfaulting ruby is something we don't generally have the resources for. Ruby is also going to be revving their versions more aggressively and dropping support more aggressively so rhel-based /usr/bin/ruby is going to suck harder and harder in the future. Ubuntu will be better but once an LTS gets fairly long in the tooth, the /usr/bin/ruby is likely to be out of support and latest chef will probably stop installing on it.

from postgresql.

lamont-granquist avatar lamont-granquist commented on September 5, 2024

@jtimberman we've got an internal roadmap item for "include more stuff in core chef" for 2015 which i had explained to me as pulling in (possibly) mysql and postgres and more commonly used but really annoying things. i think its ill defined though.

from postgresql.

mshappe avatar mshappe commented on September 5, 2024

@lamont-granquist Oh, I never use the distro ruby, anyway, personally -- I'm an RVM aficionado -- but I take your point. A chef-client install needs a reliable, self-contained universe of interpreters and libraries, even if the user will be using other libraries and rubies for their own project (in fact, especially if...).

from postgresql.

chaserx avatar chaserx commented on September 5, 2024

same issue here.

from postgresql.

hulu1522 avatar hulu1522 commented on September 5, 2024

Just submitted PR #215 which will solve the issue until Chef 12.0.2 (at which point we don't need this fix) but I think another solution should be worked out.

from postgresql.

lamont-granquist avatar lamont-granquist commented on September 5, 2024

we'll ship 12.0.2 pretty soon, so i'm not sure merging a workaround in this cookbook is the best idea.

from postgresql.

hulu1522 avatar hulu1522 commented on September 5, 2024

@lamont-granquist so when you say "pretty soon" is there a release ETA with that? Just curious...

from postgresql.

lamont-granquist avatar lamont-granquist commented on September 5, 2024

Its a patch release so "a week or so", any tighter ETA is just going to be a lie.

from postgresql.

hulu1522 avatar hulu1522 commented on September 5, 2024

Thanks, I'll keep an eye out for the release. :)

from postgresql.

nozpheratu avatar nozpheratu commented on September 5, 2024

Thanks for the hot fix, works exactly as advertised. Looking forward to those libpath fixes.

Now lets just hope I don't need to scale any time soon!

from postgresql.

mshappe avatar mshappe commented on September 5, 2024

@nozpheratu It was pretty straightforward to add @hulu1522 's code above to a ruby_block section in a recipe, so I don't see why scaling would be an issue.

from postgresql.

lamont-granquist avatar lamont-granquist commented on September 5, 2024

12.0.3 is being built today with ruby's libpath disabled, it'll ship today/tomorrow-ish and then the workarounds shouldn't be necessary.

from postgresql.

nozpheratu avatar nozpheratu commented on September 5, 2024

@mshappe That was mostly tongue-in-cheek. I didn't know about ruby_block though, I'll have to check that out.

from postgresql.

mshappe avatar mshappe commented on September 5, 2024

@nozpheratu I didn't either 'til yesterday 😄 Works like various other execution-oriented blocks, including the ability to set action :nothing and trigger it elsewhere.

from postgresql.

jtimberman avatar jtimberman commented on September 5, 2024

Chef 12.0.3 is released.

https://www.chef.io/blog/2014/12/16/release-chef-client-12-0-3/

from postgresql.

hulu1522 avatar hulu1522 commented on September 5, 2024

Closed PR #215 because Chef 12.0.3 was released and fixes the issue. Anyone using the hotfix code above no longer needs to use it. Thanks @jtimberman :)

from postgresql.

andre1810 avatar andre1810 commented on September 5, 2024

Same issue here on 12.0.3:

Recipe: postgresql::ruby
  * chef_gem[pg] action install

    ================================================================================
    Error executing action `install` on resource 'chef_gem[pg]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '1'
    ---- Begin output of /opt/chef/embedded/bin/gem install pg -q --no-rdoc --no-ri -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 ./siteconf20150108-10667-dr4hn.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 /opt/chef/embedded/bin/gem install pg -q --no-rdoc --no-ri -v "0.18.1" ----
    Ran /opt/chef/embedded/bin/gem install pg -q --no-rdoc --no-ri -v "0.18.1" returned 1

mkmf.log: http://pastebin.com/aRg4REA9

from postgresql.

troyready avatar troyready commented on September 5, 2024

This also currently affects the current chefdk (v0.3.5)

from postgresql.

slyness avatar slyness commented on September 5, 2024

Tracking this. Labeled as blocked as this mainly appears to be related to ruby issues packaged with Chef omnibus and will likely be resolved in Chef 12 at some point.

from postgresql.

vajapravin avatar vajapravin commented on September 5, 2024

Facing same issue on Suse Enterprise. Issue is not with OS and PostgreSQL.

rvmsudo gem install pg -- --with-pg-config=/usr/lib/postgresql93/bin/pg_config --with-pg-lib=/usr/include/pgsql/libpq/
Building native extensions with: '--with-pg-config=/usr/lib/postgresql93/bin/pg_config --with-pg-lib=/usr/include/pgsql/libpq/'
This could take a while...
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:73: warning: Insecure world writable dir /usr/local/rvm/gems/ruby-2.1.2@cmaa-rails4/bin in PATH, mode 042777
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.

/usr/local/rvm/rubies/ruby-2.1.2/bin/ruby -r ./siteconf20150211-15891-1f05xb7.rb extconf.rb --with-pg-config=/usr/lib/postgresql93/bin/pg_config --with-pg-lib=/usr/include/pgsql/libpq/

Using config values from /usr/lib/postgresql93/bin/pg_config
extconf.rb:32: warning: Insecure world writable dir /usr/local/rvm/gems/ruby-2.1.2@cmaa-rails4/bin in PATH, mode 042777
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
--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=/usr/local/rvm/rubies/ruby-2.1.2/bin/ruby
--with-pg
--without-pg
--with-pg-config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-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 /usr/local/rvm/gems/ruby-2.1.2@cmaa-rails4/gems/pg-0.17.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.1.2@cmaa-rails4/extensions/x86_64-linux/2.1.0/pg-0.17.1/gem_make.out

from postgresql.

lamont-granquist avatar lamont-granquist commented on September 5, 2024

@vajapravin are you even using Chef and/or the postgresql cookbook? If you're looking for general support on installing the pg gem into rvm then you've come to the wrong place. If you're using chef without omnibus and installing via rvm you also very definitely are not hitting this bug.

I can tell you that the pg gem is not finding the postgres client libraries, so you almost certainly do not have the libraries installed correctly on your OS and the issue is probably with the OS not having the correct packages, or else you need to look elsewhere to get support for the pg gem installing in SuSE.

from postgresql.

amdprophet avatar amdprophet commented on September 5, 2024

This issue seems to have been fixed with the release of Chef 12.0.3. The test-kitchen suites are passing as a confirmation.

from postgresql.

tpitale avatar tpitale commented on September 5, 2024

I'm still seeing this issue with this cookbook and the pg gem not finding libpq. It installs fine when it is the only thing in the run list, but adding any other cookbooks to the run list (which may trigger postgresql::ruby) causes the same failure.

from postgresql.

vajapravin avatar vajapravin commented on September 5, 2024

@lamont-granquist - issue was with packages. was unable to found packages on suse. installed packages and it's gone. thx

from postgresql.

tpitale avatar tpitale commented on September 5, 2024

For anyone that may find this issue later, I switched to using https://github.com/phlipper/chef-postgresql/, which appears to be actively developed at this time, and supports features that I needed, at least.

from postgresql.

vajapravin avatar vajapravin commented on September 5, 2024

@sfroehler - gcc and g++ is installed?

from postgresql.

mshappe avatar mshappe commented on September 5, 2024

@sfroehler You don't have build-essential installed. The gem isn't finding make!

from postgresql.

sfroehler avatar sfroehler commented on September 5, 2024

gcc is installed, g++ not - and make is also missing. I don't know why i didn't see this early and I thought this was installed by the build-essentials cookbook.

When I install g++ and make via apt-get install it works. Not sure whats going wrong here, but it seems to be a different issue. Sorry for the confusion.

from postgresql.

sfroehler avatar sfroehler commented on September 5, 2024

@mshappe yeah, I just realized that make is missing. But I have build-essential installed...not sure whats going wrong

from postgresql.

amdprophet avatar amdprophet commented on September 5, 2024

@sfroehler have you set the compile_time attribute to true? https://github.com/opscode-cookbooks/build-essential#user-content-gems-with-c-extensions

from postgresql.

sfroehler avatar sfroehler commented on September 5, 2024

@amdprophet yes, I did. But still getting the same error. 😕

from postgresql.

sfroehler avatar sfroehler commented on September 5, 2024

This is actually also done in the ruby recipe: https://github.com/hw-cookbooks/postgresql/blob/develop/recipes/ruby.rb#L32

from postgresql.

axos88 avatar axos88 commented on September 5, 2024

Hello, I'm still seeing this on chef 12.1.0, using the postgresql cookbook, and trying to bundle install pg under rbenv_ruby 2.1.5:

root@vultr:/home/git/gitlab/.bundle/ruby/2.1.0/gems/pg-0.15.1/ext# chef-solo --version
Chef: 12.1.0

I did remove the CONFIG["LIBPATHENV"] = "LD_LIBRARY_PATH", but it did not help.

Here is my log:

root@vultr:/home/git/gitlab/.bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0/pg-0.15.1# cat mkmf.log
find_executable: checking for pg_config... -------------------- yes

--------------------

find_header: checking for libpq-fe.h... -------------------- yes

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/opt/chef/embedded/include -O3 -g -pipe -I/opt/chef/embedded/include   -I/usr/include/postgresql -I/opt/chef/embedded/include -O3 -g -pipe -fPIC conftest.c  -L. -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L. -Wl,-rpath,/opt/chef/embedded/lib -fstack-protector -L/opt/chef/embedded/lib -rdynamic -Wl,-export-dynamic -L/opt/chef/embedded/lib  -Wl,-R/opt/chef/embedded/lib  -L/usr/lib -Wl,-rpath,/usr/lib     -Wl,-R -Wl,/opt/chef/embedded/lib -L/opt/chef/embedded/lib -lruby  -lpthread -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"gcc -E -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/opt/chef/embedded/include -O3 -g -pipe -I/opt/chef/embedded/include   -I/usr/include/postgresql -I/opt/chef/embedded/include -O3 -g -pipe -fPIC  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
/* end */

--------------------

find_header: checking for libpq/libpq-fs.h... -------------------- yes

"gcc -E -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/opt/chef/embedded/include -O3 -g -pipe -I/opt/chef/embedded/include   -I/usr/include/postgresql -I/opt/chef/embedded/include -O3 -g -pipe -fPIC  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq/libpq-fs.h>
/* end */

--------------------

find_header: checking for pg_config_manual.h... -------------------- yes

"gcc -E -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/opt/chef/embedded/include -O3 -g -pipe -I/opt/chef/embedded/include   -I/usr/include/postgresql -I/opt/chef/embedded/include -O3 -g -pipe -fPIC  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <pg_config_manual.h>
/* end */

--------------------

have_library: checking for PQconnectdb() in -lpq... -------------------- no

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/opt/chef/embedded/include -O3 -g -pipe -I/opt/chef/embedded/include   -I/usr/include/postgresql -I/opt/chef/embedded/include -O3 -g -pipe -fPIC conftest.c  -L. -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L. -Wl,-rpath,/opt/chef/embedded/lib -fstack-protector -L/opt/chef/embedded/lib -rdynamic -Wl,-export-dynamic -L/opt/chef/embedded/lib  -Wl,-R/opt/chef/embedded/lib  -L/usr/lib -Wl,-rpath,/usr/lib     -Wl,-R -Wl,/opt/chef/embedded/lib -L/opt/chef/embedded/lib -lruby -lpq  -lpthread -ldl -lcrypt -lm   -lc"
/usr/lib/libpq.so: undefined reference to `SSL_CTX_use_certificate_chain_file@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_write@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_set_fd@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_use_PrivateKey_file@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `CRYPTO_set_locking_callback@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_NAME_get_text_by_NID@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_connect@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_init@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_STORE_load_locations@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_get_cert_store@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_ctrl@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_free@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_library_init@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_ctrl@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ERR_get_error@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_pending@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_free@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_get_subject_name@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_use_certificate_file@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_check_private_key@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_load_error_strings@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_by_id@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_get_peer_certificate@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_new@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `CRYPTO_num_locks@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_load_private_key@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_finish@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_set_verify@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_free@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `CRYPTO_set_id_callback@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_get_error@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_new@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_shutdown@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_use_PrivateKey@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `TLSv1_method@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_STORE_set_flags@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_read@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `OPENSSL_config@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_load_verify_locations@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ERR_reason_error_string@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_set_ex_data@OPENSSL_1.0.0'
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: #include <libpq-fe.h>
 4:
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return 0; }
/* end */

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/opt/chef/embedded/include -O3 -g -pipe -I/opt/chef/embedded/include   -I/usr/include/postgresql -I/opt/chef/embedded/include -O3 -g -pipe -fPIC conftest.c  -L. -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L. -Wl,-rpath,/opt/chef/embedded/lib -fstack-protector -L/opt/chef/embedded/lib -rdynamic -Wl,-export-dynamic -L/opt/chef/embedded/lib  -Wl,-R/opt/chef/embedded/lib  -L/usr/lib -Wl,-rpath,/usr/lib     -Wl,-R -Wl,/opt/chef/embedded/lib -L/opt/chef/embedded/lib -lruby -lpq  -lpthread -ldl -lcrypt -lm   -lc"
conftest.c: In function ‘t’:
conftest.c:15:1: error: too few arguments to function ‘PQconnectdb’
 int t(void) { PQconnectdb(); return 0; }
 ^
In file included from conftest.c:3:0:
/usr/include/postgresql/libpq-fe.h:250:16: note: declared here
 extern PGconn *PQconnectdb(const char *conninfo);
                ^
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: #include <libpq-fe.h>
 4:
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { PQconnectdb(); return 0; }
/* end */

--------------------

have_library: checking for PQconnectdb() in -llibpq... -------------------- no

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/opt/chef/embedded/include -O3 -g -pipe -I/opt/chef/embedded/include   -I/usr/include/postgresql -I/opt/chef/embedded/include -O3 -g -pipe -fPIC conftest.c  -L. -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L. -Wl,-rpath,/opt/chef/embedded/lib -fstack-protector -L/opt/chef/embedded/lib -rdynamic -Wl,-export-dynamic -L/opt/chef/embedded/lib  -Wl,-R/opt/chef/embedded/lib  -L/usr/lib -Wl,-rpath,/usr/lib     -Wl,-R -Wl,/opt/chef/embedded/lib -L/opt/chef/embedded/lib -lruby -llibpq  -lpthread -ldl -lcrypt -lm   -lc"
/usr/bin/ld: cannot find -llibpq
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: #include <libpq-fe.h>
 4:
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return 0; }
/* end */

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/opt/chef/embedded/include -O3 -g -pipe -I/opt/chef/embedded/include   -I/usr/include/postgresql -I/opt/chef/embedded/include -O3 -g -pipe -fPIC conftest.c  -L. -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L. -Wl,-rpath,/opt/chef/embedded/lib -fstack-protector -L/opt/chef/embedded/lib -rdynamic -Wl,-export-dynamic -L/opt/chef/embedded/lib  -Wl,-R/opt/chef/embedded/lib  -L/usr/lib -Wl,-rpath,/usr/lib     -Wl,-R -Wl,/opt/chef/embedded/lib -L/opt/chef/embedded/lib -lruby -llibpq  -lpthread -ldl -lcrypt -lm   -lc"
conftest.c: In function ‘t’:
conftest.c:15:1: error: too few arguments to function ‘PQconnectdb’
 int t(void) { PQconnectdb(); return 0; }
 ^
In file included from conftest.c:3:0:
/usr/include/postgresql/libpq-fe.h:250:16: note: declared here
 extern PGconn *PQconnectdb(const char *conninfo);
                ^
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: #include <libpq-fe.h>
 4:
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { PQconnectdb(); return 0; }
/* end */

--------------------

have_library: checking for PQconnectdb() in -lms/libpq... -------------------- no

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/opt/chef/embedded/include -O3 -g -pipe -I/opt/chef/embedded/include   -I/usr/include/postgresql -I/opt/chef/embedded/include -O3 -g -pipe -fPIC conftest.c  -L. -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L. -Wl,-rpath,/opt/chef/embedded/lib -fstack-protector -L/opt/chef/embedded/lib -rdynamic -Wl,-export-dynamic -L/opt/chef/embedded/lib  -Wl,-R/opt/chef/embedded/lib  -L/usr/lib -Wl,-rpath,/usr/lib     -Wl,-R -Wl,/opt/chef/embedded/lib -L/opt/chef/embedded/lib -lruby -lms/libpq  -lpthread -ldl -lcrypt -lm   -lc"
/usr/bin/ld: cannot find -lms/libpq
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: #include <libpq-fe.h>
 4:
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return 0; }
/* end */

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/opt/chef/embedded/include -O3 -g -pipe -I/opt/chef/embedded/include   -I/usr/include/postgresql -I/opt/chef/embedded/include -O3 -g -pipe -fPIC conftest.c  -L. -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L. -Wl,-rpath,/opt/chef/embedded/lib -fstack-protector -L/opt/chef/embedded/lib -rdynamic -Wl,-export-dynamic -L/opt/chef/embedded/lib  -Wl,-R/opt/chef/embedded/lib  -L/usr/lib -Wl,-rpath,/usr/lib     -Wl,-R -Wl,/opt/chef/embedded/lib -L/opt/chef/embedded/lib -lruby -lms/libpq  -lpthread -ldl -lcrypt -lm   -lc"
conftest.c: In function ‘t’:
conftest.c:15:1: error: too few arguments to function ‘PQconnectdb’
 int t(void) { PQconnectdb(); return 0; }
 ^
In file included from conftest.c:3:0:
/usr/include/postgresql/libpq-fe.h:250:16: note: declared here
 extern PGconn *PQconnectdb(const char *conninfo);
                ^
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: #include <libpq-fe.h>
 4:
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { PQconnectdb(); return 0; }
/* end */

--------------------

root@vultr:/home/git/gitlab/.bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0/pg-0.15.1#

from postgresql.

nlopes avatar nlopes commented on September 5, 2024

Also broken in ubuntu 14.04 pg-0.18.2 using chef client 12.3.0-1. Same output pretty much as @axos88 (minus his pg version).

I have tried everything in this thread and nothing helps. Any ideas?

Update: just tried with 12.4.0, same issue

from postgresql.

patcon avatar patcon commented on September 5, 2024

FYI build-essential cookbook wasn't running at compile time for me either (chef 11.16.4 omnibus), but manually setting node['build-essential']['compile_time'] = true in my .kitchen.yml allowed the run the complete

from postgresql.

nlopes avatar nlopes commented on September 5, 2024

Can this be re-opened @amdprophet ?

from postgresql.

patcon avatar patcon commented on September 5, 2024

FYI I was working on spiking out a pg-chef-gem cookbook as an analog to the approach of the mysql2_chef_gem cookbook.

It's not yet working and I had to move on to something else for now, but I can't see why it shouldn't be possible, if someone wants to submit PRs. A custom postgresql is required for now, and can be found in the berksfile. test-kitchen suite should be functional.

from postgresql.

lazzarello avatar lazzarello commented on September 5, 2024

Pls reopen. Same issue as @nlopes Debian 7 with ChefDK released .deb.

Also, hi @patcon

from postgresql.

vblessing avatar vblessing commented on September 5, 2024

I'm seeing this issue with Ubuntu 14.04 and Chef Client 12.4.2, getting the same output as @sfroehler.
It's looking like no one really has a good answer to this?

from postgresql.

epu avatar epu commented on September 5, 2024

Hit this with chefdk 7.0 / chef-solo 12.4.1. Reverted to chef-solo 11.14.2 for testing, deploying.

from postgresql.

jpeyret avatar jpeyret commented on September 5, 2024

Yeah, hitting this too. Maybe this hacky workaround will give someone more capable a bit of insight.

vagrant@vagrant:~$ chef-client -v
Chef: 12.4.3

Vagrant 1.7.4
Ubuntu 14.04 guest on Mac 10.9.5 host

audrey:ubuntu2 jluc$ chef -v
Chef Development Kit Version: 0.7.0
chef-client version: 12.4.1
berks version: 3.2.4
kitchen version: 1.4.2

workaround:
I've added build essential to my wrapper bemyerp-postgresql's metadata.rb

depends 'build-essential' #this was added
depends 'postgresql'

Now, this is not the only cookbook to require build-essential in my build, so I found it odd that I would encounter this problem.

Apparently however, if my bemyerp-postgresql cookbooks recipe are first in the sequence, before other cookbooks using build-essential, then things are ok. If other cookbooks using build_essential go first, then fail.

Could it be that postgresql's use of build_essential requires it to be 'just so'. Which it gets if it goes first, but not if it some other cookbooks gets there first?

from postgresql.

JackChance avatar JackChance commented on September 5, 2024

test-kitchen 1.4.2
chef-dk 0.8.0
hostbox: windows 7
guestbox: OEL 6.5
locked to omnibus version 12.3.0 (dsc resources fail nastily on 12.4+)

Running into this same issue on test kitchen when attempting to install berkflow 0.7.0

gem_package 'berkflow' do
  version '0.7.0'
  options('--no-document --no-user-install --install-dir /opt/chefdk/embedded/lib/ruby/gems/2.1.0')
  action :install
end

Attempted the fix mentioned above (no difference in behavior)

fix = Chef::Util::FileEdit.new('/opt/chef/embedded/lib/ruby/2.1.0/x86_64-linux/rbconfig.rb')
fix.search_file_delete_line('^.*LIBPATHENV.*$')
fix.write_file

The error claims that a file was made at /opt/chefdk/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/ffi-1.9.10/gem_make.out but the only one on the system was /opt/chefdk/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/ffi-1.9.8/gem_make.out, contents are

/opt/chef/embedded/bin/ruby -r ./siteconf20150428-27228-1lwal9u.rb extconf.rb
checking for ffi_call() in -lffi... yes
checking for ffi_prep_closure()... yes
checking for ffi_raw_call()... yes
checking for ffi_prep_raw_closure()... yes
checking for rb_thread_blocking_region()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
checking for ffi_prep_cif_var()... yes
creating extconf.h
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling StructByValue.c
compiling FunctionInfo.c
compiling Type.c
compiling ClosurePool.c
compiling Buffer.c
compiling LastError.c
compiling Variadic.c
compiling Platform.c
compiling LongDouble.c
compiling Types.c
compiling Pointer.c
compiling AbstractMemory.c
compiling Function.c
compiling StructByReference.c
compiling MemoryPointer.c
compiling MappedType.c
compiling StructLayout.c
compiling DynamicLibrary.c
compiling DataConverter.c
compiling Call.c
compiling ArrayType.c
compiling ffi.c
compiling Struct.c
compiling MethodHandle.c
compiling Thread.c
linking shared-object ffi_c.so

make "DESTDIR=" install
/usr/bin/install -c -m 0755 ffi_c.so ./.gem.20150428-27228-sdvhfc
installing default ffi_c libraries

If I manually install the berkflow gem with

chef gem install berkflow -v 0.7.0 --no-user-install

it works as expected.

On a side note, execute 'chef gem install berkflow -v 0.7.0 --no-user-install' places it on a strange path under root when I would expect it to be under /opt/chefdk/.../bin

I'm trying to make a pre-configured chef workstation with the gems my org adds in for our workflow

from postgresql.

acqant avatar acqant commented on September 5, 2024

+1 Seeing this on mysql gem.
chef 12.3.0
trying the "fix" now.

from postgresql.

qhartman avatar qhartman commented on September 5, 2024

Also hitting this on Ubuntu 14.04 w/ chef-client 12.3.0. Trying to install pg for an lwrp I wrote, have libpq-dev installed at the system level.

from postgresql.

acqant avatar acqant commented on September 5, 2024

What's odd for me is it's failing running this
/opt/sensu/embedded/bin/ruby extconf.rb

It didn't even get to the part where it tried to compile it or at least didn't log it.
Running chef a second time works however.

I put ignore_failures true for the gem install just so jenkins would stop failing and the gem eventually gets installed but it's not a gem I need other that would be problematic.

from postgresql.

patcon avatar patcon commented on September 5, 2024

Try setting default['apt']['compile_time_update'] = true. Build essential is required at compile time as part of the pg gem install process, but you need to manually make sure that apt-get update is running before that.

I seem to remember some reason this couldn't be done automatically, but maybe I'm wrong...

from postgresql.

acqant avatar acqant commented on September 5, 2024

tried the compile time, didn't work.
tried downgrading chef, didn't work.

What's odd is it's not even getting to the point of compiling the gem it fails earlier than that.

from postgresql.

qhartman avatar qhartman commented on September 5, 2024

Yeah, I've tried all the recommended work-around to no avail. For me, it can't find the libpq-dev dependency even though it is installed and the pg gem installs for the system ruby just fine. In my case since there doesn't seem to be a direct solution to this readily available I'm going to rewrite my lwrp to shell out to psql commands. It's going to be a bit of a PITA, but it's better than not working at all.

from postgresql.

patcon avatar patcon commented on September 5, 2024

Ah, just ran into this again yesterday when working on a new cookbook, and saw that I needed to set build-essentil['compile_time'' to true manually, even though it was supposedly in the postgresql::ruby recipe. But I did get it working. I seem to remember a related "normal" level attribute set in some other cookbook, so I'd recommend override, rather than the "default" level I suggested above.

from postgresql.

acqant avatar acqant commented on September 5, 2024

I changed the order of the gem install and it's better. I got the same
error on another gem ( zookeeper ) but that hasn't repeated.

What is the root cause of all this? This isn't just a pg gem issue.

On Mon, Dec 7, 2015 at 3:19 PM, Patrick Connolly [email protected]
wrote:

Ah, just ran into this again yesterday when working on a new cookbook, and
saw that I needed to set build-essentil['compile_time'' to true manually,
even though it was supposedly in the postgresql::ruby recipe. But I did get
it working. I seem to remember a related "normal" level attribute set in
some other cookbook, so I'd recommend override, rather than the "default"
level I suggested above.


Reply to this email directly or view it on GitHub
#212 (comment)
.

from postgresql.

qhartman avatar qhartman commented on September 5, 2024

It has something to do with how the dependency paths for the omnibus components are set. I've lifted the solution from the postgres cookbook referenced above into my LWRP and it seems to work: https://github.com/hw-cookbooks/postgresql/blob/develop/recipes/ruby.rb#L32

from postgresql.

patcon avatar patcon commented on September 5, 2024

What is the root cause of all this?

I think the mysql2_chef_gem cookbook has the proper future-oriented approach (see my comment above for link to abandonned WIP)

from postgresql.

acqant avatar acqant commented on September 5, 2024

following up, in my case the problem was lack of memory. I changed my resource to run
gem install --debug and saw the error about not being able to allocate memory.

from postgresql.

ashwinrayaprolu avatar ashwinrayaprolu commented on September 5, 2024

I'm getting this. This is first time i'm trying to install mysql on ubuntu in vagrant environment using chef provisioner

Vagrant 1.8.5
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
Berks 4.3.5

depends 'apt', '> 2.9'
depends 'firewall', '
> 2.4'
depends 'apache2', '> 3.2.2'
depends 'mysql', '
> 8.0'
depends 'mysql2_chef_gem', '> 1.0'
depends 'database', '
> 5.1'

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/ruby/backward -I/opt/chef/embedded/include/ruby-2.1.0 -I. -I/usr/local/include -I/opt/chef/embedded/include -O2 -O3 -g -pipe -I/opt/chef/embedded/include -I/opt/chef/embedded/include -O2 -O3 -g -pipe -fPIC conftest.c -L. -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L/usr/local/lib -Wl,-R/usr/local/lib -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -L. -Wl,-rpath,/opt/chef/embedded/lib -fstack-protector -L/opt/chef/embedded/lib -rdynamic -Wl,-export-dynamic -L/opt/chef/embedded/lib -Wl,-R/opt/chef/embedded/lib -lnsl -lz -lm -Wl,-R -Wl,/opt/chef/embedded/lib -L/opt/chef/embedded/lib -lruby -lmysqlclient -lnsl -lz -lm -lpthread -lrt -ldl -lcrypt -lm -lc"
/usr/bin/ld: cannot find -lmysqlclient
collect2: error: ld returned 1 exit status

Any solution?

from postgresql.

patcon avatar patcon commented on September 5, 2024

You're in the wrong cookbook issue queue, @ashwinrayaprolu1984 ;)

Just came across this mysql, so you'll want to drop a +1 here:
sous-chefs/mysql#457

from postgresql.

ashwinrayaprolu avatar ashwinrayaprolu commented on September 5, 2024

I saw this just now . Thanks for reply i had fixed it in meantime though.

from postgresql.

lock avatar lock commented on September 5, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from postgresql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.