Comments (93)
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.
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.
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.
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.
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.
Same issue here.
from postgresql.
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.
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.
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.
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.
What is the complete output of mkmf.log?
from postgresql.
@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.
Yeah mkmf.log never makes any sense, part of the reason why I need to see the whole thing in context...
from postgresql.
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.
Here is a link to my mkmf.log
also:
http://pastebin.com/P600g6p4
from postgresql.
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.
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
from postgresql.
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.
@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.
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.
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.
We ship openssl 1.0.1j in chef-11 as well so that didn't change.
from postgresql.
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.
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 aboveknife solo cook...
and it succeeded.
from postgresql.
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.
...AIX... You are brave! 😄
from postgresql.
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.
I don't know what you're talking about @lamont-granquist ;)
from postgresql.
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.
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.
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.
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.
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.
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.
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.
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.
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.
@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.
@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.
same issue here.
from postgresql.
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.
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.
@lamont-granquist so when you say "pretty soon" is there a release ETA with that? Just curious...
from postgresql.
Its a patch release so "a week or so", any tighter ETA is just going to be a lie.
from postgresql.
Thanks, I'll keep an eye out for the release. :)
from postgresql.
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.
@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.
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.
@mshappe That was mostly tongue-in-cheek. I didn't know about ruby_block though, I'll have to check that out.
from postgresql.
@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.
Chef 12.0.3 is released.
https://www.chef.io/blog/2014/12/16/release-chef-client-12-0-3/
from postgresql.
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.
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.
This also currently affects the current chefdk (v0.3.5)
from postgresql.
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.
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.
@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.
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.
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.
@lamont-granquist - issue was with packages. was unable to found packages on suse. installed packages and it's gone. thx
from postgresql.
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.
@sfroehler - gcc and g++ is installed?
from postgresql.
@sfroehler You don't have build-essential installed. The gem isn't finding make
!
from postgresql.
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.
@mshappe yeah, I just realized that make is missing. But I have build-essential installed...not sure whats going wrong
from postgresql.
@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.
@amdprophet yes, I did. But still getting the same error. 😕
from postgresql.
This is actually also done in the ruby recipe: https://github.com/hw-cookbooks/postgresql/blob/develop/recipes/ruby.rb#L32
from postgresql.
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.
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.
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.
Can this be re-opened @amdprophet ?
from postgresql.
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.
Pls reopen. Same issue as @nlopes Debian 7 with ChefDK released .deb.
Also, hi @patcon
from postgresql.
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.
Hit this with chefdk 7.0 / chef-solo 12.4.1. Reverted to chef-solo 11.14.2 for testing, deploying.
from postgresql.
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.
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.
+1 Seeing this on mysql gem.
chef 12.3.0
trying the "fix" now.
from postgresql.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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'> 2.4'
depends 'firewall', '
depends 'apache2', '> 3.2.2'> 8.0'
depends 'mysql', '
depends 'mysql2_chef_gem', '> 1.0'> 5.1'
depends 'database', '
"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.
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.
I saw this just now . Thanks for reply i had fixed it in meantime though.
from postgresql.
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)
- Unable to connect to an RDS instance from AWS because of lack of password HOT 1
- external_pid_file and stats_temp_directory set incorrectly when installing different version than 12 (default)
- postgresql_extension install fails - NoMethodError: undefined method `[]' for nil:NilClass
- certificate verify failed (certificate has expired) - https://download.postgresql.org/pub/repos/yum/RPM-GPG-KEY-PGDG HOT 2
- Cannot install with a different data directory
- Permit yum options to be passed via recipes
- Readme needs required Chef version bumping to 16.0+
- SCRAM-SHA-256 documentation
- Unable to create PostgreSQL users
- Unable to use the distribution packages HOT 3
- Converge fails in `postgresql_access`-resource HOT 1
- postgresql_access raises `NoMethodError: undefined method `named_captures' for nil:NilClass` HOT 2
- Skip YUM repository configuration in postgres_install resource
- Dependency Dashboard
- invalid pg_hba.conf when the values are longer than the defined width's HOT 1
- uninitialized constant #<Class:0x00007f3d9ecc4e70>::PostgresqlCookbook HOT 1
- Wrong PG version detected
- `pg_hba.conf` doesn't reach a stable state
- postgresql_access Resource fails when multiple databases or users are specified
- Add tests for PG 15 and 16 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postgresql.