I can install the pg gem just fine via system ruby (after installing libpq-dev), but it fails using the embedded ruby:
/opt/sensu/embedded/bin/gem install pg
ERROR: While executing gem … (Gem::FilePermissionError) You don’t have write permissions for the /opt/sensu/embedded/lib/ruby/gems/2.0.0 directory.anowell@monitoring:/opt/sensu/embedded/bin$ sudo ./gem install pg
Building native extensions. This could take a while…
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/opt/sensu/embedded/bin/ruby extconf.rbchecking for pg_config... yesUsing 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.
Digging through mkmf.log (attached), it seems it found the lib, it’s just not compatible with it (too few args, and undefined SSL references).
have_library: checking for PQconnectdb() in -lpq… -------------------- no
“gcc -o conftest -I/opt/sensu/embedded/include/ruby-2.0.0/x86_64-linux -I/opt/sensu/embedded/include/ruby-2.0.0/ruby/backward -I/opt/sensu/embedded/include/ruby-2.0.0 -I. -I/opt/sensu/embedded/include -I/usr/include/postgresql -L/opt/sensu/embedded/lib -I/opt/sensu/embedded/include -fPIC conftest.c -L. -L/opt/sensu/embedded/lib -Wl,-R/opt/sensu/embedded/lib -L/opt/sensu/embedded/lib -Wl,-R/opt/sensu/embedded/lib -L. -Wl,-rpath /opt/sensu/embedded/lib -L/opt/sensu/embedded/lib -I/opt/sensu/embedded/include -fstack-protector -rdynamic -Wl,-export-dynamic -L/opt/sensu/embedded/lib -Wl,-R/opt/sensu/embedded/lib -L/usr/lib -Wl,-rpath,/usr/lib -Wl,-R -Wl,/opt/sensu/embedded/lib -L/opt/sensu/embedded/lib -lruby -lpq -lpthread -lrt -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’
… <snip - full log attached> …
conftest.c:8:1: error: too few arguments to function ‘PQconnectdb’
I’d appreciate any insight that gets me closer to using the pg gem in my sensu checks.
mkmf.log (12.2 KB)
Did you ever figure out the problem here? I’m trying to get it installed on ubuntu 14.04 and I’m having the same issue.
···
On Monday, June 17, 2013 3:11:55 PM UTC-5, Anthony Nowell wrote:
I can install the pg gem just fine via system ruby (after installing libpq-dev), but it fails using the embedded ruby:
/opt/sensu/embedded/bin/gem install pg
ERROR: While executing gem … (Gem::FilePermissionError) You don’t have write permissions for the /opt/sensu/embedded/lib/ruby/gems/2.0.0 directory.anowell@monitoring:/ opt/sensu/embedded/bin$ sudo ./gem install pg
Building native extensions. This could take a while…
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/opt/sensu/embedded/bin/ruby extconf.rbchecking for pg_config... yesUsing 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.
Digging through mkmf.log (attached), it seems it found the lib, it’s just not compatible with it (too few args, and undefined SSL references).
have_library: checking for PQconnectdb() in -lpq… -------------------- no
“gcc -o conftest -I/opt/sensu/embedded/include/ruby-2.0.0/x86_64-linux -I/opt/sensu/embedded/include/ruby-2.0.0/ruby/backward -I/opt/sensu/embedded/include/ruby-2.0.0 -I. -I/opt/sensu/embedded/include -I/usr/include/postgresql -L/opt/sensu/embedded/lib -I/opt/sensu/embedded/include -fPIC conftest.c -L. -L/opt/sensu/embedded/lib -Wl,-R/opt/sensu/embedded/lib -L/opt/sensu/embedded/lib -Wl,-R/opt/sensu/embedded/lib -L. -Wl,-rpath /opt/sensu/embedded/lib -L/opt/sensu/embedded/lib -I/opt/sensu/embedded/include -fstack-protector -rdynamic -Wl,-export-dynamic -L/opt/sensu/embedded/lib -Wl,-R/opt/sensu/embedded/lib -L/usr/lib -Wl,-rpath,/usr/lib -Wl,-R -Wl,/opt/sensu/embedded/lib -L/opt/sensu/embedded/lib -lruby -lpq -lpthread -lrt -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’
… <snip - full log attached> …
conftest.c:8:1: error: too few arguments to function ‘PQconnectdb’
I’d appreciate any insight that gets me closer to using the pg gem in my sensu checks.
Hmm.. This is going to be pretty tricky.
If you ldd /usr/lib/libpq.so, it will be linked against your *system* openssl.
But, as you can see from that gcc invocation, the gem is being built
against the libs / headers / config of the embedded sensu openssl
version.
This mismatch is your issue.
At least on my system, my sensu libruby is not linked against the
embedded sensu libssl? (except the openssl binary)
Maybe you could try temporarily moving the embedded libssl and headers
out of the way to help the build along? (shot in the dark there)
···
On Sun, Nov 9, 2014 at 5:15 PM, Jonathan Slusher <jonslusher@gmail.com> wrote:
Did you ever figure out the problem here? I'm trying to get it installed on
ubuntu 14.04 and I'm having the same issue.
On Monday, June 17, 2013 3:11:55 PM UTC-5, Anthony Nowell wrote:
I can install the pg gem just fine via system ruby (after installing
libpq-dev), but it fails using the embedded ruby:
/opt/sensu/embedded/bin/gem install pg
ERROR: While executing gem ... (Gem::FilePermissionError) You don't
have write permissions for the /opt/sensu/embedded/lib/ruby/gems/2.0.0
directory.anowell@monitoring:/opt/sensu/embedded/bin$ sudo ./gem install pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/opt/sensu/embedded/bin/ruby extconf.rbchecking for pg_config...
yesUsing 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.
Digging through mkmf.log (attached), it seems it found the lib, it's just
not compatible with it (too few args, and undefined SSL references).
have_library: checking for PQconnectdb() in -lpq... --------------------
no
"gcc -o conftest -I/opt/sensu/embedded/include/ruby-2.0.0/x86_64-linux
-I/opt/sensu/embedded/include/ruby-2.0.0/ruby/backward
-I/opt/sensu/embedded/include/ruby-2.0.0 -I. -I/opt/sensu/embedded/include
-I/usr/include/postgresql -L/opt/sensu/embedded/lib
-I/opt/sensu/embedded/include -fPIC conftest.c -L.
-L/opt/sensu/embedded/lib -Wl,-R/opt/sensu/embedded/lib
-L/opt/sensu/embedded/lib -Wl,-R/opt/sensu/embedded/lib -L. -Wl,-rpath
/opt/sensu/embedded/lib -L/opt/sensu/embedded/lib
-I/opt/sensu/embedded/include -fstack-protector -rdynamic
-Wl,-export-dynamic -L/opt/sensu/embedded/lib -Wl,-R/opt/sensu/embedded/lib
-L/usr/lib -Wl,-rpath,/usr/lib -Wl,-R -Wl,/opt/sensu/embedded/lib
-L/opt/sensu/embedded/lib -lruby -lpq -lpthread -lrt -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'
... <snip - full log attached> ...
conftest.c:8:1: error: too few arguments to function ‘PQconnectdb’
I'd appreciate any insight that gets me closer to using the pg gem in my
sensu checks.
Thank you for reaching out. I think the easier option for me since I’m using chef is to not use the embedded ruby. I’m running into env variable problems, but those I think are easier to manage than trying to mess with trying to bind libraries.
···
On Sunday, November 9, 2014 8:33:22 PM UTC-6, Kyle Anderson wrote:
Hmm… This is going to be pretty tricky.
If you ldd /usr/lib/libpq.so, it will be linked against your system openssl.
But, as you can see from that gcc invocation, the gem is being built
against the libs / headers / config of the embedded sensu openssl
version.
This mismatch is your issue.
At least on my system, my sensu libruby is not linked against the
embedded sensu libssl? (except the openssl binary)
Maybe you could try temporarily moving the embedded libssl and headers
out of the way to help the build along? (shot in the dark there)
On Sun, Nov 9, 2014 at 5:15 PM, Jonathan Slusher jonsl...@gmail.com wrote:
Did you ever figure out the problem here? I’m trying to get it installed on
ubuntu 14.04 and I’m having the same issue.
On Monday, June 17, 2013 3:11:55 PM UTC-5, Anthony Nowell wrote:
I can install the pg gem just fine via system ruby (after installing
libpq-dev), but it fails using the embedded ruby:
/opt/sensu/embedded/bin/gem install pg
ERROR: While executing gem … (Gem::FilePermissionError) You don’t
have write permissions for the /opt/sensu/embedded/lib/ruby/gems/2.0.0
directory.anowell@monitoring:/opt/sensu/embedded/bin$ sudo ./gem install pg
Building native extensions. This could take a while…
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/opt/sensu/embedded/bin/ruby extconf.rbchecking for pg_config...
yesUsing 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.
Digging through mkmf.log (attached), it seems it found the lib, it’s just
not compatible with it (too few args, and undefined SSL references).
have_library: checking for PQconnectdb() in -lpq… --------------------
no
“gcc -o conftest -I/opt/sensu/embedded/include/ruby-2.0.0/x86_64-linux
-I/opt/sensu/embedded/include/ruby-2.0.0/ruby/backward
-I/opt/sensu/embedded/include/ruby-2.0.0 -I. -I/opt/sensu/embedded/include
-I/usr/include/postgresql -L/opt/sensu/embedded/lib
-I/opt/sensu/embedded/include -fPIC conftest.c -L.
-L/opt/sensu/embedded/lib -Wl,-R/opt/sensu/embedded/lib
-L/opt/sensu/embedded/lib -Wl,-R/opt/sensu/embedded/lib -L. -Wl,-rpath
/opt/sensu/embedded/lib -L/opt/sensu/embedded/lib
-I/opt/sensu/embedded/include -fstack-protector -rdynamic
-Wl,-export-dynamic -L/opt/sensu/embedded/lib -Wl,-R/opt/sensu/embedded/lib
-L/usr/lib -Wl,-rpath,/usr/lib -Wl,-R -Wl,/opt/sensu/embedded/lib
-L/opt/sensu/embedded/lib -lruby -lpq -lpthread -lrt -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’
… <snip - full log attached> …
conftest.c:8:1: error: too few arguments to function ‘PQconnectdb’
I’d appreciate any insight that gets me closer to using the pg gem in my
sensu checks.