Thread: undefined reference to `SSL_new' when linking with lib-pq.a version 7.4.7-2

undefined reference to `SSL_new' when linking with lib-pq.a version 7.4.7-2

From
Moncef Mezghani
Date:
Hi,
I am porting a g++ application using lib-pq.a, which compile and link 
fine on MAC OS X, on linux Debian Sarge.
The link step failed on this error:
/usr/lib/libpq.a(fe-secure.o)(.text+0x6a): In function 
`pqsecure_open_client':
: undefined reference to `SSL_new'
/usr/lib/libpq.a(fe-secure.o)(.text+0x86): In function 
`pqsecure_open_client':
: undefined reference to `SSL_set_ex_data'
/usr/lib/libpq.a(fe-secure.o)(.text+0xe1): In function 
`pqsecure_open_client':
: undefined reference to `SSL_set_fd'
/usr/lib/libpq.a(fe-secure.o)(.text+0x150): In function `pqsecure_read':
: undefined reference to `SSL_read'
/usr/lib/libpq.a(fe-secure.o)(.text+0x164): In function `pqsecure_read':
: undefined reference to `SSL_get_error'
/usr/lib/libpq.a(fe-secure.o)(.text+0x315): In function 
`pqsecure_write':
: undefined reference to `SSL_write'
/usr/lib/libpq.a(fe-secure.o)(.text+0x32c): In function 
`pqsecure_write':
: undefined reference to `SSL_get_error'
/usr/lib/libpq.a(fe-secure.o)(.text+0x552): In function `load_dh_file':
: undefined reference to `PEM_read_DHparams'
/usr/lib/libpq.a(fe-secure.o)(.text+0x568): In function `load_dh_file':
: undefined reference to `DH_size'
/usr/lib/libpq.a(fe-secure.o)(.text+0x58b): In function `load_dh_file':
: undefined reference to `DH_check'
/usr/lib/libpq.a(fe-secure.o)(.text+0x5e8): In function 
`load_dh_buffer':
: undefined reference to `BIO_new_mem_buf'
/usr/lib/libpq.a(fe-secure.o)(.text+0x60a): In function 
`load_dh_buffer':
: undefined reference to `PEM_read_bio_DHparams'
/usr/lib/libpq.a(fe-secure.o)(.text+0x614): In function 
`load_dh_buffer':
: undefined reference to `BIO_free'
/usr/lib/libpq.a(fe-secure.o)(.text+0x68a): In function `tmp_dh_cb':
: undefined reference to `DH_size'
/usr/lib/libpq.a(fe-secure.o)(.text+0x6ae): In function `tmp_dh_cb':
: undefined reference to `DH_generate_parameters'
/usr/lib/libpq.a(fe-secure.o)(.text+0x841): In function 
`client_cert_cb':
: undefined reference to `SSL_get_ex_data'
/usr/lib/libpq.a(fe-secure.o)(.text+0x912): In function 
`client_cert_cb':
: undefined reference to `PEM_read_X509'
/usr/lib/libpq.a(fe-secure.o)(.text+0x9c0): In function 
`client_cert_cb':
: undefined reference to `X509_free'
/usr/lib/libpq.a(fe-secure.o)(.text+0xa79): In function 
`client_cert_cb':
: undefined reference to `PEM_read_PrivateKey'
/usr/lib/libpq.a(fe-secure.o)(.text+0xa9b): In function 
`client_cert_cb':
: undefined reference to `X509_check_private_key'
/usr/lib/libpq.a(fe-secure.o)(.text+0xae9): In function 
`client_cert_cb':
: undefined reference to `X509_free'
/usr/lib/libpq.a(fe-secure.o)(.text+0xaf6): In function 
`client_cert_cb':
: undefined reference to `EVP_PKEY_free'
/usr/lib/libpq.a(fe-secure.o)(.text+0xb46): In function 
`client_cert_cb':
: undefined reference to `X509_free'
/usr/lib/libpq.a(fe-secure.o)(.text+0xbe2): In function 
`client_cert_cb':
: undefined reference to `X509_free'
/usr/lib/libpq.a(fe-secure.o)(.text+0xcdd): In function 
`initialize_SSL':
: undefined reference to `SSL_library_init'
/usr/lib/libpq.a(fe-secure.o)(.text+0xce2): In function 
`initialize_SSL':
: undefined reference to `SSL_load_error_strings'
/usr/lib/libpq.a(fe-secure.o)(.text+0xce7): In function 
`initialize_SSL':
: undefined reference to `TLSv1_method'
/usr/lib/libpq.a(fe-secure.o)(.text+0xcef): In function 
`initialize_SSL':
: undefined reference to `SSL_CTX_new'
/usr/lib/libpq.a(fe-secure.o)(.text+0xd9b): In function 
`initialize_SSL':
: undefined reference to `SSL_CTX_load_verify_locations'
/usr/lib/libpq.a(fe-secure.o)(.text+0xdc4): In function 
`initialize_SSL':
: undefined reference to `SSL_CTX_set_verify'
/usr/lib/libpq.a(fe-secure.o)(.text+0xddb): In function 
`initialize_SSL':
: undefined reference to `SSL_CTX_set_verify_depth'
/usr/lib/libpq.a(fe-secure.o)(.text+0xdf3): In function 
`initialize_SSL':
: undefined reference to `SSL_CTX_set_tmp_dh_callback'
/usr/lib/libpq.a(fe-secure.o)(.text+0xe19): In function 
`initialize_SSL':
: undefined reference to `SSL_CTX_ctrl'
/usr/lib/libpq.a(fe-secure.o)(.text+0xed9): In function `destroy_SSL':
: undefined reference to `SSL_CTX_free'
/usr/lib/libpq.a(fe-secure.o)(.text+0xf1a): In function 
`open_client_SSL':
: undefined reference to `SSL_connect'
/usr/lib/libpq.a(fe-secure.o)(.text+0xf32): In function 
`open_client_SSL':
: undefined reference to `SSL_get_peer_certificate'
/usr/lib/libpq.a(fe-secure.o)(.text+0xf8b): In function 
`open_client_SSL':
: undefined reference to `X509_get_subject_name'
/usr/lib/libpq.a(fe-secure.o)(.text+0xfa1): In function 
`open_client_SSL':
: undefined reference to `X509_NAME_oneline'
/usr/lib/libpq.a(fe-secure.o)(.text+0xfb6): In function 
`open_client_SSL':
: undefined reference to `X509_get_subject_name'
/usr/lib/libpq.a(fe-secure.o)(.text+0xfda): In function 
`open_client_SSL':
: undefined reference to `X509_NAME_get_text_by_NID'
/usr/lib/libpq.a(fe-secure.o)(.text+0xffe): In function 
`open_client_SSL':
: undefined reference to `SSL_get_error'
/usr/lib/libpq.a(fe-secure.o)(.text+0x10dc): In function `close_SSL':
: undefined reference to `X509_free'
/usr/lib/libpq.a(fe-secure.o)(.text+0x10f4): In function `close_SSL':
: undefined reference to `SSL_shutdown'
/usr/lib/libpq.a(fe-secure.o)(.text+0x1102): In function `close_SSL':
: undefined reference to `SSL_free'
/usr/lib/libpq.a(fe-secure.o)(.text+0x1128): In function 
`SSLerrmessage':
: undefined reference to `ERR_get_error'
/usr/lib/libpq.a(fe-secure.o)(.text+0x1146): In function 
`SSLerrmessage':
: undefined reference to `ERR_reason_error_string'
/usr/lib/libpq.a(fe-auth.o)(.text+0x9a): In function `pg_krb5_init':
: undefined reference to `krb5_init_context'
/usr/lib/libpq.a(fe-auth.o)(.text+0xba): In function `pg_krb5_init':
: undefined reference to `krb5_cc_default'
/usr/lib/libpq.a(fe-auth.o)(.text+0xe4): In function `pg_krb5_init':
: undefined reference to `krb5_cc_get_principal'
/usr/lib/libpq.a(fe-auth.o)(.text+0x10e): In function `pg_krb5_init':
: undefined reference to `krb5_unparse_name'
/usr/lib/libpq.a(fe-auth.o)(.text+0x13e): In function `pg_krb5_init':
: undefined reference to `error_message'
/usr/lib/libpq.a(fe-auth.o)(.text+0x175): In function `pg_krb5_init':
: undefined reference to `krb5_free_principal'
/usr/lib/libpq.a(fe-auth.o)(.text+0x18d): In function `pg_krb5_init':
: undefined reference to `krb5_cc_close'
/usr/lib/libpq.a(fe-auth.o)(.text+0x19b): In function `pg_krb5_init':
: undefined reference to `krb5_free_context'
/usr/lib/libpq.a(fe-auth.o)(.text+0x1ad): In function `pg_krb5_init':
: undefined reference to `error_message'
/usr/lib/libpq.a(fe-auth.o)(.text+0x1d6): In function `pg_krb5_init':
: undefined reference to `error_message'
/usr/lib/libpq.a(fe-auth.o)(.text+0x1ff): In function `pg_krb5_init':
: undefined reference to `error_message'
/usr/lib/libpq.a(fe-auth.o)(.text+0x2f4): In function 
`pg_krb5_sendauth':
: undefined reference to `krb5_sname_to_principal'
/usr/lib/libpq.a(fe-auth.o)(.text+0x39d): In function 
`pg_krb5_sendauth':
: undefined reference to `krb5_free_principal'
/usr/lib/libpq.a(fe-auth.o)(.text+0x419): In function 
`pg_krb5_sendauth':
: undefined reference to `krb5_sendauth'
/usr/lib/libpq.a(fe-auth.o)(.text+0x430): In function 
`pg_krb5_sendauth':
: undefined reference to `error_message'
/usr/lib/libpq.a(fe-auth.o)(.text+0x47d): In function 
`pg_krb5_sendauth':
: undefined reference to `krb5_free_principal'
/usr/lib/libpq.a(fe-auth.o)(.text+0x507): In function 
`pg_krb5_sendauth':
: undefined reference to `krb5_free_error'
/usr/lib/libpq.a(fe-auth.o)(.text+0x561): In function 
`pg_krb5_sendauth':
: undefined reference to `error_message'
/usr/lib/libpq.a(fe-auth.o)(.text+0x79f): In function 
`pg_password_sendauth':
: undefined reference to `crypt'
/usr/lib/libpq.a(fe-misc.o)(.text+0x101c): In function `pqSocketCheck':
: undefined reference to `SSL_pending'
collect2: ld returned 1 exit status

Did somebody have an idea how to fix the problem?

Many thanks.
Moncef.
mme@lediet.fr