On Tue July 19 2011, Albrecht Schlosser wrote:
> On 19.07.2011 07:20, [email protected] 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:* [email protected] <mailto:[email protected]>
> >
> > *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.
>
Good 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
using Eclipse with the CDT plug-in (for C/C++ coding) since it
has 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",
or "HowTo use Eclipse", but we have come this far. . . . .
Open your terminal window; enter:
whereis libldap
libldap: /usr/lib/libldap.a /usr/lib/libldap.so
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" -
The symbols this library provides (meaning this library is __before__
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__
the providers of these symbols in the link command),
Enter:
nm --undefined-only /usr/lib/libldap.a
Note:
The nm ("names") utility will do the same for dynamic libraries (*.so),
object files (*.o) along with the static libraries (*.a).
Mike
PS: The Eclipse CDT plug-in uses the toolchain to draw that explorer tree
window - I am not sure why your installation isn't doing the above for you.
> HTH
>
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]