Can't find the PostgreSQL client library (libpq)

Issue #288 resolved
Олександр Гошиллик
created an issue

When try to install gem pg have an error:

Building native extensions. This could take a while...
ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

    current directory: /home/ubuntu/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pg-1.1.3/ext
/home/ubuntu/.rbenv/versions/2.5.1/bin/ruby -r ./siteconf20181125-30328-q1e74z.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
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/home/ubuntu/.rbenv/versions/2.5.1/bin/$(RUBY_BASE_NAME)
        --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

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

  /home/ubuntu/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0-static/pg-1.1.3/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/ubuntu/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pg-1.1.3 for inspection.
Results logged to /home/ubuntu/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0-static/pg-1.1.3/gem_make.out

mkmf.log:

find_executable: checking for pg_config... -------------------- yes

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

find_header: checking for libpq-fe.h... -------------------- yes
"gcc -o conftest -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/x86_64-linux -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/ruby/backward -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0 -I. -I/usr/include/postgresql -I/home/ubuntu/.rbenv/versions/2.5.1/include    -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wno-maybe-uninitialized conftest.c  -L. -L/home/ubuntu/.rbenv/versions/2.5.1/lib -Wl,-rpath,/home/ubuntu/.rbenv/versions/2.5.1/lib -L/usr/lib/x86_64-linux-gnu -Wl,-rpath,/usr/lib/x86_64-linux-gnu -L. -L/home/ubuntu/.rbenv/versions/2.5.1/lib  -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-rpath,/home/ubuntu/.rbenv/versions/2.5.1/lib -L/home/ubuntu/.rbenv/versions/2.5.1/lib -lruby-static  -lpthread -lgmp -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/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/x86_64-linux -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/ruby/backward -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0 -I. -I/usr/include/postgresql -I/home/ubuntu/.rbenv/versions/2.5.1/include    -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wno-maybe-uninitialized  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/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/x86_64-linux -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/ruby/backward -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0 -I. -I/usr/include/postgresql -I/home/ubuntu/.rbenv/versions/2.5.1/include    -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wno-maybe-uninitialized  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/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/x86_64-linux -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/ruby/backward -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0 -I. -I/usr/include/postgresql -I/home/ubuntu/.rbenv/versions/2.5.1/include    -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wno-maybe-uninitialized  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/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/x86_64-linux -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/ruby/backward -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0 -I. -I/usr/include/postgresql -I/home/ubuntu/.rbenv/versions/2.5.1/include    -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -
have_library: checking for PQconnectdb() in -lpq... -------------------- no

"gcc -o conftest -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/x86_64-linux -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/ruby/backward -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0 -I. -I/usr/include/postgresql -I/home/ubuntu/.rbenv/versions/2.5.1/include    -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wno-maybe-uninitialized conftest.c  -L. -L/home/ubuntu/.rbenv/versions/2.5.1/lib -Wl,-rpath,/home/ubuntu/.rbenv/versions/2.5.1/lib -L/usr/lib/x86_64-linux-gnu -Wl,-rpath,/usr/lib/x86_64-linux-gnu -L. -L/home/ubuntu/.rbenv/versions/2.5.1/lib  -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-rpath,/home/ubuntu/.rbenv/versions/2.5.1/lib -L/home/ubuntu/.rbenv/versions/2.5.1/lib -lruby-static -lpq  -lpthread -lgmp -ldl -lcrypt -lm   -lc"
Wno-maybe-uninitialized conftest.c  -L. -L/home/ubuntu/.rbenv/versions/2.5.1/lib -Wl,-rpath,/home/ubuntu/.rbenv/versions/2.5.1/lib -L/usr/lib/x86_64-linux-gnu -Wl,-rpath,/usr/lib/x86_64-linux-gnu -L. -L/home/ubuntu/.rbenv/versions/2.5.1/lib  -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-rpath,/home/ubuntu/.rbenv/versions/2.5.1/lib -L/home/ubuntu/.rbenv/versions/2.5.1/lib -lruby-static -lpq  -lpthread -lgmp -ldl -lcrypt -lm   -lc"

/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_CTX_use_certificate_chain_file@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_write@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `BIO_new@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_use_PrivateKey_file@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `CRYPTO_set_locking_callback@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_connect@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `BIO_clear_flags@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `CRYPTO_get_id_callback@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `BIO_set_flags@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `sk_free@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `ENGINE_init@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `X509_STORE_load_locations@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_CTX_get_cert_store@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `X509_NAME_get_entry@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_ctrl@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_free@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `CRYPTO_num_locks@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `ERR_put_error@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `X509_get_ext_d2i@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_get_current_cipher@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `ENGINE_load_private_key@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `ENGINE_finish@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_CIPHER_get_bits@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_set_verify@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `X509_free@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `CRYPTO_set_id_callback@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_CTX_free@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_get_error@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_get_current_compression@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_new@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_shutdown@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_set_bio@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `ASN1_STRING_length@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_use_PrivateKey@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `X509_STORE_set_flags@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_read@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `OPENSSL_config@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `ASN1_STRING_data@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_CTX_load_verify_locations@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `ERR_reason_error_string@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_CIPHER_get_name@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_set_ex_data@OPENSSL_1.0.0'
/home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `sk_num@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 !p; }
/* end */

"gcc -o conftest -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/x86_64-linux -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/ruby/backward -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0 -I. -I/usr/include/postgresql -I/home/ubuntu/.rbenv/versions/2.5.1/include    -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wno-maybe-uninitialized conftest.c  -L. -L/home/ubuntu/.rbenv/versions/2.5.1/lib -Wl,-rpath,/home/ubuntu/.rbenv/versions/2.5.1/lib -L/usr/lib/x86_64-linux-gnu -Wl,-rpath,/usr/lib/x86_64-linux-gnu -L. -L/home/ubuntu/.rbenv/versions/2.5.1/lib  -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-rpath,/home/ubuntu/.rbenv/versions/2.5.1/lib -L/home/ubuntu/.rbenv/versions/2.5.1/lib -lruby-static -lpq  -lpthread -lgmp -ldl -lcrypt -lm   -lc"
conftest.c:15:13: error: conflicting types for 'PQconnectdb'
 extern void PQconnectdb();
             ^
In file included from conftest.c:3:0:
/usr/include/postgresql/libpq-fe.h:250:16: note: previous declaration of 'PQconnectdb' was here
 extern PGconn *PQconnectdb(const char *conninfo);
                ^
cc1: warning: unrecognized command line option '-Wno-self-assign'
cc1: warning: unrecognized command line option '-Wno-constant-logical-operand'
cc1: warning: unrecognized command line option '-Wno-parentheses-equality'
cc1: warning: unrecognized command line option '-Wno-tautological-compare'
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: extern void PQconnectdb();
16: int t(void) { PQconnectdb(); return 0; }
/* end */

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

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

"gcc -o conftest -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/x86_64-linux -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/ruby/backward -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0 -I. -I/usr/include/postgresql -I/home/ubuntu/.rbenv/versions/2.5.1/include    -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wno-maybe-uninitialized conftest.c  -L. -L/home/ubuntu/.rbenv/versions/2.5.1/lib -Wl,-rpath,/home/ubuntu/.rbenv/versions/2.5.1/lib -L/usr/lib/x86_64-linux-gnu -Wl,-rpath,/usr/lib/x86_64-linux-gnu -L. -L/home/ubuntu/.rbenv/versions/2.5.1/lib  -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-rpath,/home/ubuntu/.rbenv/versions/2.5.1/lib -L/home/ubuntu/.rbenv/versions/2.5.1/lib -lruby-static -llibpq  -lpthread -lgmp -ldl -lcrypt -lm   -lc"
/home/ubuntu/.linuxbrew/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 !p; }
/* end */

"gcc -o conftest -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/x86_64-linux -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/ruby/backward -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0 -I. -I/usr/include/postgresql -I/home/ubuntu/.rbenv/versions/2.5.1/include    -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wno-maybe-uninitialized conftest.c  -L. -L/home/ubuntu/.rbenv/versions/2.5.1/lib -Wl,-rpath,/home/ubuntu/.rbenv/versions/2.5.1/lib -L/usr/lib/x86_64-linux-gnu -Wl,-rpath,/usr/lib/x86_64-linux-gnu -L. -L/home/ubuntu/.rbenv/versions/2.5.1/lib  -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-rpath,/home/ubuntu/.rbenv/versions/2.5.1/lib -L/home/ubuntu/.rbenv/versions/2.5.1/lib -lruby-static -llibpq  -lpthread -lgmp -ldl -lcrypt -lm   -lc"
conftest.c:15:13: error: conflicting types for 'PQconnectdb'
 extern void PQconnectdb();
             ^
In file included from conftest.c:3:0:
/usr/include/postgresql/libpq-fe.h:250:16: note: previous declaration of 'PQconnectdb' was here
 extern PGconn *PQconnectdb(const char *conninfo);
                ^
cc1: warning: unrecognized command line option '-Wno-self-assign'
cc1: warning: unrecognized command line option '-Wno-constant-logical-operand'
cc1: warning: unrecognized command line option '-Wno-parentheses-equality'
cc1: warning: unrecognized command line option '-Wno-tautological-compare'
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: extern void PQconnectdb();
16: int t(void) { PQconnectdb(); return 0; }
/* end */

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

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

"gcc -o conftest -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/x86_64-linux -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/ruby/backward -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0 -I. -I/usr/include/postgresql -I/home/ubuntu/.rbenv/versions/2.5.1/include    -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wno-maybe-uninitialized conftest.c  -L. -L/home/ubuntu/.rbenv/versions/2.5.1/lib -Wl,-rpath,/home/ubuntu/.rbenv/versions/2.5.1/lib -L/usr/lib/x86_64-linux-gnu -Wl,-rpath,/usr/lib/x86_64-linux-gnu -L. -L/home/ubuntu/.rbenv/versions/2.5.1/lib  -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-rpath,/home/ubuntu/.rbenv/versions/2.5.1/lib -L/home/ubuntu/.rbenv/versions/2.5.1/lib -lruby-static -lms/libpq  -lpthread -lgmp -ldl -lcrypt -lm   -lc"
/home/ubuntu/.linuxbrew/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 !p; }
/* end */

"gcc -o conftest -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/x86_64-linux -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0/ruby/backward -I/home/ubuntu/.rbenv/versions/2.5.1/include/ruby-2.5.0 -I. -I/usr/include/postgresql -I/home/ubuntu/.rbenv/versions/2.5.1/include    -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wno-maybe-uninitialized conftest.c  -L. -L/home/ubuntu/.rbenv/versions/2.5.1/lib -Wl,-rpath,/home/ubuntu/.rbenv/versions/2.5.1/lib -L/usr/lib/x86_64-linux-gnu -Wl,-rpath,/usr/lib/x86_64-linux-gnu -L. -L/home/ubuntu/.rbenv/versions/2.5.1/lib  -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-rpath,/home/ubuntu/.rbenv/versions/2.5.1/lib -L/home/ubuntu/.rbenv/versions/2.5.1/lib -lruby-static -lms/libpq  -lpthread -lgmp -ldl -lcrypt -lm   -lc"
conftest.c:15:13: error: conflicting types for 'PQconnectdb'
 extern void PQconnectdb();
             ^
In file included from conftest.c:3:0:
/usr/include/postgresql/libpq-fe.h:250:16: note: previous declaration of 'PQconnectdb' was here
 extern PGconn *PQconnectdb(const char *conninfo);
                ^
cc1: warning: unrecognized command line option '-Wno-self-assign'
cc1: warning: unrecognized command line option '-Wno-constant-logical-operand'
cc1: warning: unrecognized command line option '-Wno-parentheses-equality'
cc1: warning: unrecognized command line option '-Wno-tautological-compare'
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: extern void PQconnectdb();
16: int t(void) { PQconnectdb(); return 0; }
/* end */

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

Comments (4)

  1. Lars Kanis
    /home/ubuntu/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.so: undefined reference to `SSL_CTX_use_certificate_chain_file@OPENSSL_1.0.0'
    

    There's something wrong with your PostgreSQL installation. You may try to re-build or re-install it.

  2. Log in to comment