Okay, it is acting like my /usr/lib/libssl.a is of no value.  First, just for 
comparison, attempting to link with no reference to libssl at all:

[root@linux Release]# g++  -o"<My exe name>"  <my object file list> 
/usr/lib/libcrypto.a /usr/lib/libldap.a /usr/lib/libxml2.a /usr/lib/liblber.a 
-lz -ldl -lm -lsasl2 2>&1
/usr/lib/libldap.a(os-ip.o): In function `ldap_int_poll':
(.text+0x9c4): warning: `sys_errlist' is deprecated; use `strerror' or 
`strerror_r' instead
/usr/lib/libldap.a(os-ip.o): In function `ldap_int_poll':
(.text+0x9ba): warning: `sys_nerr' is deprecated; use `strerror' or 
`strerror_r' instead
./LinuxAgent.o: In function `Agent::startCommandProcessor()':
LinuxAgent.cpp:(.text+0x438): undefined reference to `pthread_create'
./LinuxAgent.o: In function `Agent::Run()':
LinuxAgent.cpp:(.text+0x47b7): undefined reference to `pthread_create'
./Redirect.o: In function `Redirect::RunRedirect(char*, int, int, char*, int, 
int)':
Redirect.cpp:(.text+0x19b): undefined reference to `pthread_create'
./VncRedirector.o: In function `Redir::RunVNC(char*, int, int)':
VncRedirector.cpp:(.text+0x19b): undefined reference to `pthread_create'
/usr/lib/libldap.a(tls_o.o): In function `tlso_sb_close':
(.text+0xa6): undefined reference to `SSL_shutdown'
/usr/lib/libldap.a(tls_o.o): In function `tlso_session_upflags':
(.text+0x13b): undefined reference to `SSL_get_error'
/usr/lib/libldap.a(tls_o.o): In function `tlso_sb_write':
(.text+0x1cc): undefined reference to `SSL_write'
/usr/lib/libldap.a(tls_o.o): In function `tlso_sb_write':
(.text+0x1df): undefined reference to `SSL_get_error'
/usr/lib/libldap.a(tls_o.o): In function `tlso_sb_read':
(.text+0x2cc): undefined reference to `SSL_read'
/usr/lib/libldap.a(tls_o.o): In function `tlso_sb_read':
(.text+0x2df): undefined reference to `SSL_get_error'
/usr/lib/libldap.a(tls_o.o): In function `tlso_sb_ctrl':
(.text+0x409): undefined reference to `SSL_pending'
...<more errors>...
/usr/lib/libldap.a(gssapi.o): In function `ldap_gssapi_bind_s':
(.text+0x16e7): undefined reference to `gss_release_buffer'
/usr/lib/libldap.a(gssapi.o): In function `ldap_gssapi_bind_s':
(.text+0x177f): undefined reference to `gss_init_sec_context'
/usr/lib/libldap.a(gssapi.o): In function `ldap_gssapi_bind_s':
(.text+0x190d): undefined reference to `gss_release_buffer'
collect2: ld returned 1 exit status

Now, including /usr/lib/libssl.a at the end of the list of object file:

[root@linux Release]# g++  -o"<My exe name>" <my object file list>   
/usr/lib/libcrypto.a /usr/lib/libldap.a /usr/lib/libxml2.a /usr/lib/liblber.a 
/usr/lib/libssl.a -lz -ldl -lm -lsasl2 2>&1
/usr/lib/libldap.a(os-ip.o): In function `ldap_int_poll':
(.text+0x9c4): warning: `sys_errlist' is deprecated; use `strerror' or 
`strerror_r' instead
/usr/lib/libldap.a(os-ip.o): In function `ldap_int_poll':
(.text+0x9ba): warning: `sys_nerr' is deprecated; use `strerror' or 
`strerror_r' instead
./LinuxAgent.o: In function `Agent::startCommandProcessor()':
LinuxAgent.cpp:(.text+0x438): undefined reference to `pthread_create'
./LinuxAgent.o: In function `Agent::Run()':
LinuxAgent.cpp:(.text+0x47b7): undefined reference to `pthread_create'
./Redirect.o: In function `Redirect::RunRedirect(char*, int, int, char*, int, 
int)':
Redirect.cpp:(.text+0x19b): undefined reference to `pthread_create'
./VncRedirector.o: In function `Redir::RunVNC(char*, int, int)':
VncRedirector.cpp:(.text+0x19b): undefined reference to `pthread_create'
/usr/lib/libldap.a(tls_o.o): In function `tlso_session_chkhost':
(.text+0x8a6): undefined reference to `X509_get_ext_by_NID'
/usr/lib/libldap.a(tls_o.o): In function `tlso_session_chkhost':
(.text+0x8bd): undefined reference to `X509_get_ext'
/usr/lib/libldap.a(tls_o.o): In function `tlso_session_chkhost':
(.text+0x8c5): undefined reference to `X509V3_EXT_d2i'
/usr/lib/libldap.a(tls_o.o): In function `tlso_session_chkhost':
(.text+0x9be): undefined reference to `GENERAL_NAMES_free'
/usr/lib/libldap.a(tls_o.o): In function `tlso_session_chkhost':
(.text+0x9d7): undefined reference to `GENERAL_NAMES_free'
/usr/lib/libldap.a(tls_o.o): In function `tlso_session_chkhost':
(.text+0x9f5): undefined reference to `X509_get_subject_name'
/usr/lib/libldap.a(tls_o.o): In function `tlso_session_chkhost':
(.text+0xa00): undefined reference to `X509_NAME_entry_count'
...<more errors>...
/usr/lib/libssl.a(s3_both.o): In function `ssl_cert_type':
(.text+0x1e5): undefined reference to `EVP_PKEY_free'
/usr/lib/libssl.a(s3_both.o): In function `ssl3_add_cert_to_buf':
(.text+0x61e): undefined reference to `i2d_X509'
/usr/lib/libssl.a(s3_both.o): In function `ssl3_add_cert_to_buf':
(.text+0x677): undefined reference to `i2d_X509'
/usr/lib/libssl.a(s3_both.o): In function `ssl3_output_cert_chain':
(.text+0x854): undefined reference to `X509_STORE_CTX_init'
/usr/lib/libssl.a(s3_both.o): In function `ssl3_output_cert_chain':
(.text+0x86c): undefined reference to `X509_verify_cert'
/usr/lib/libssl.a(s3_both.o): In function `ssl3_output_cert_chain':
(.text+0x8c9): undefined reference to `X509_STORE_CTX_cleanup'
/usr/lib/libssl.a(s3_both.o): In function `ssl3_output_cert_chain':
(.text+0x972): undefined reference to `X509_STORE_CTX_cleanup'
collect2: ld returned 1 exit status

Now, including /usr/lib/libssl.a at the beginning of the list of object file:

[root@linux Release]# g++  -o"<My exe name>" <my object file list>  
/usr/lib/libssl.a /usr/lib/libcrypto.a /usr/lib/libldap.a /usr/lib/libxml2.a 
/usr/lib/liblber.a -lz -ldl -lm -lsasl2 2>&1
/usr/lib/libldap.a(os-ip.o): In function `ldap_int_poll':
(.text+0x9c4): warning: `sys_errlist' is deprecated; use `strerror' or 
`strerror_r' instead
/usr/lib/libldap.a(os-ip.o): In function `ldap_int_poll':
(.text+0x9ba): warning: `sys_nerr' is deprecated; use `strerror' or 
`strerror_r' instead
./LinuxAgent.o: In function `Agent::startCommandProcessor()':
LinuxAgent.cpp:(.text+0x438): undefined reference to `pthread_create'
./LinuxAgent.o: In function `Agent::Run()':
LinuxAgent.cpp:(.text+0x47b7): undefined reference to `pthread_create'
./Redirect.o: In function `Redirect::RunRedirect(char*, int, int, char*, int, 
int)':
Redirect.cpp:(.text+0x19b): undefined reference to `pthread_create'
./VncRedirector.o: In function `Redir::RunVNC(char*, int, int)':
VncRedirector.cpp:(.text+0x19b): undefined reference to `pthread_create'
/usr/lib/libldap.a(tls_o.o): In function `tlso_sb_close':
(.text+0xa6): undefined reference to `SSL_shutdown'
/usr/lib/libldap.a(tls_o.o): In function `tlso_session_upflags':
(.text+0x13b): undefined reference to `SSL_get_error'
/usr/lib/libldap.a(tls_o.o): In function `tlso_sb_write':
(.text+0x1cc): undefined reference to `SSL_write'
/usr/lib/libldap.a(tls_o.o): In function `tlso_sb_write':
(.text+0x1df): undefined reference to `SSL_get_error'
/usr/lib/libldap.a(tls_o.o): In function `tlso_sb_read':
(.text+0x2cc): undefined reference to `SSL_read'
/usr/lib/libldap.a(tls_o.o): In function `tlso_sb_read':
(.text+0x2df): undefined reference to `SSL_get_error'
/usr/lib/libldap.a(tls_o.o): In function `tlso_sb_ctrl':
(.text+0x409): undefined reference to `SSL_pending'
/usr/lib/libldap.a(tls_o.o): In function `tlso_sb_remove':
(.text+0x4ab): undefined reference to `SSL_free'
...<more errors>...
/usr/lib/libldap.a(gssapi.o): In function `ldap_gssapi_bind_s':
(.text+0x1178): undefined reference to `gss_release_name'
/usr/lib/libldap.a(gssapi.o): In function `ldap_gssapi_bind_s':
(.text+0x1474): undefined reference to `gss_import_name'
/usr/lib/libldap.a(gssapi.o): In function `ldap_gssapi_bind_s':
(.text+0x149e): undefined reference to `gss_indicate_mechs'
/usr/lib/libldap.a(gssapi.o): In function `ldap_gssapi_bind_s':
(.text+0x1582): undefined reference to `gss_test_oid_set_member'
/usr/lib/libldap.a(gssapi.o): In function `ldap_gssapi_bind_s':
(.text+0x1594): undefined reference to `gss_release_oid_set'
/usr/lib/libldap.a(gssapi.o): In function `ldap_gssapi_bind_s':
(.text+0x1661): undefined reference to `gss_init_sec_context'
/usr/lib/libldap.a(gssapi.o): In function `ldap_gssapi_bind_s':
(.text+0x16e7): undefined reference to `gss_release_buffer'
/usr/lib/libldap.a(gssapi.o): In function `ldap_gssapi_bind_s':
(.text+0x177f): undefined reference to `gss_init_sec_context'
/usr/lib/libldap.a(gssapi.o): In function `ldap_gssapi_bind_s':
(.text+0x190d): undefined reference to `gss_release_buffer'
collect2: ld returned 1 exit status

Now, giving up and allowing it to choose the so version, suddenly everything 
works.  There are two warnings, but no errors.

[root@linux Release]# g++  -o"<My exe name>" <my object file list>  
/usr/lib/libcrypto.a /usr/lib/libldap.a /usr/lib/libxml2.a /usr/lib/liblber.a 
-lz -ldl -lm -lssl -lsasl2 2>&1
/usr/lib/libldap.a(os-ip.o): In function `ldap_int_poll':
(.text+0x9c4): warning: `sys_errlist' is deprecated; use `strerror' or 
`strerror_r' instead
/usr/lib/libldap.a(os-ip.o): In function `ldap_int_poll':
(.text+0x9ba): warning: `sys_nerr' is deprecated; use `strerror' or 
`strerror_r' instead
[root@linux Release]# 


Anyone have an idea why the static version of the library doesn't seem to work?

Thanks.


Brandon


-----Original Message-----
From: Michael S. Zick <open...@morethan.org>
To: openssl-users <openssl-users@openssl.org>
Sent: Tue, Jul 19, 2011 8:27 am
Subject: Re: Trying to Link Statically to Libcrypto


On Tue July 19 2011, Albrecht Schlosser wrote:
   On 19.07.2011 13:30, Michael S. Zick wrote:
 > But a quicker answer to just a symbol or a few: use the toolchain.
 
 ...
 
 > Now enter:
 > nm /usr/lib/libldap.a
 > be rewarded with a listing 1,830 lines long of the symbols defined
 > and the external symbols referenced.
 >
 > Of course, entering:
 > nm --help
 > will give you the command options, and
 > man nm
 > will give you all of the sicken details (the manual "man" command is
 > your friend on any *nix type system).
 >
 > But for those readers interested in the "instant answer" -
 >
 
 I'm afraid you got it the wrong way around:
 
You are correct, my bad.
The linker makes an internal list of the __required__ symbols and
hen (actually, at the same time) tries to satisfy that list by
he symbols provided in the __following listed__ libraries.
I wrote those directions backwards - a major brain fart on my part.
Very glad you spotted my error.
ike
> > The symbols this library provides (meaning this library is __before__
 
 This should read "__after__" ...
 
 > the users of these symbols in the link command),
 > Enter:
 > nm --defined /usr/lib/libldap.a
 >
 > The symbols this library requires (meaning this library is __after__
 
 ... and this should read "__before__" .
 
 > the providers of these symbols in the link command),
 > Enter:
 > nm --undefined-only /usr/lib/libldap.a

_____________________________________________________________________
penSSL Project                                 http://www.openssl.org
ser Support Mailing List                    openssl-users@openssl.org
utomated List Manager                           majord...@openssl.org

Reply via email to