Thanks for the lesson.  Highly informative.








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


On Tue July 19 2011, Albrecht Schlosser wrote:
   On 19.07.2011 07:20, brandon...@aol.com wrote:
 > Actually, I was advised to put libssl after libcrypto.
 
 I'm afraid that is the wrong order. See below.
 
 >   I don't recall being told to put libssl after libldap.
 
 Yep, may be. The rule is that libs with objects that are used
 by another lib must be placed after that lib. Since libldap
 uses libssl, libldap must be placed before libssl.
 
 >   Also, knowing that order matters is of little use if you don't grasp 
 > what the order should be.
 
 That's true, but sometimes you can guess or you see that one library
 needs another one by looking at the error messages:
 
 *From:* brandon...@aol.com <mailto:brandon...@aol.com>
 >
 >     *Sent:* Monday, July 18, 2011 4:46 PM
 >     I put the -static where it belongs.  Here is a partial list of the
 >     output:
 >     /usr/lib/gcc/i586-redhat-linux/4.4.1/../../../libldap.a(tls_o.o):
 >     In function `tlso_sb_close':
 >     (.text+0xa6): undefined reference to `SSL_shutdown'
 >
 
 Here you see that the function tlso_sb_close needs SSL_shutdown
 and that tlso_sb_close is in tls_o.o, which is in libldap.a.
 
 Guess, where you can find SSL_shutdown? ;-)
 
 Here is a simplified example that links statically with libssl
 (and libcrypto), but not with libldap:
 
 g++ -o my_prog.exe my_prog.o ../../my_lib/mylib.a \
    -static /usr/local/xx/lib/libtiff.a \
    /usr/local/xx/lib/libssl.a /usr/local/xx/lib/libcrypto.a \
    -lws2_32
 
 Since libldap needs libssl, you can put it where the example
 has libtiff.a (you won't need that anyway, it's only an example),
 and you should be done ... unless libldap has other dependencies
 on libs that are not mentioned here. You'd need to look up this
 in the libldap docs.

ood advice: "Read the docs".
But a quicker answer to just a symbol or a few: use the toolchain.
I am beginning to think that somewhere along the line you stopped
sing Eclipse with the CDT plug-in (for C/C++ coding) since it
as a window for this object/library relationship exploring.
or you have that window closed.) 
This really isn't a mailing list for "HowTo use gnu toolchain",
r "HowTo use Eclipse", but we have come this far. . . . .
Open your terminal window; enter:
hereis libldap
ibldap: /usr/lib/libldap.a /usr/lib/libldap.so
Now enter:
m /usr/lib/libldap.a
e rewarded with a listing 1,830 lines long of the symbols defined
nd the external symbols referenced.
Of course, entering:
m --help
ill give you the command options, and
an nm
ill give you all of the sicken details (the manual "man" command is 
our friend on any *nix type system).
But for those readers interested in the "instant answer" -
The symbols this library provides (meaning this library is __before__  
he users of these symbols in the link command),
nter:
m --defined /usr/lib/libldap.a
The symbols this library requires (meaning this library is __after__
he providers of these symbols in the link command),
nter:
m --undefined-only /usr/lib/libldap.a
Note:
he nm ("names") utility will do the same for dynamic libraries (*.so),
bject files (*.o) along with the static libraries (*.a).
Mike
S: The Eclipse CDT plug-in uses the toolchain to draw that explorer tree
indow - I am not sure why your installation isn't doing the above for you.
 HTH
 

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

Reply via email to