Bug 710 - ReliantUnix: -ldl missing when libcrypto is a shared object
Summary: ReliantUnix: -ldl missing when libcrypto is a shared object
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: Build system (show other bugs)
Version: -current
Hardware: MIPS Other
: P3 normal
Assignee: OpenSSH Bugzilla mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-24 03:18 AEST by Robert Dahlem
Modified: 2004-04-14 12:24 AEST (History)
0 users

See Also:


Attachments
the TRIVIAL fix (468 bytes, patch)
2003-09-24 03:19 AEST, Robert Dahlem
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Dahlem 2003-09-24 03:18:29 AEST
When libcrypto is only available as a shared object, configure fails to detect
libcrypto ("Can't find recent OpenSSL libcrypto") under ReliantUNIX, because
dlsym() is not in libc and libdl is not searched.

[ReliantUNIX weirdness: dlopen() is in libc while dlsym() is in libdl]

Trivial fix would be to add

   LIBS="$LIBS -ldl"

in case of *-sni-sysv*

More clever would be to try to compile with "-lcrypto" and if that doesn't work
then try to compile with "-lcrypto -ldl". But that's way beyond my autoconf
expertise. :-)
Comment 1 Robert Dahlem 2003-09-24 03:19:15 AEST
Created attachment 462 [details]
the TRIVIAL fix
Comment 2 Darren Tucker 2003-09-24 20:22:03 AEST
Is there any harm in using -ldl when building with a static libcrypto?
Comment 3 Robert Dahlem 2003-09-25 08:05:52 AEST
Define "harm" :-)

I tried the famous "Hello World!\n" program:

$ cc hello.c -o hello
$ ldd hello
/usr/lib/libc.so
$ cc hello.c -o hello -ld
$ ldd hello
/usr/lib/libdl.so
/usr/lib/libc.so

What you can see is that the dynamic linker honors -ldl by searching libdl.so
for any unresolved externals each time one invokes the program. It might even
map it into the processes memory. If you consider this "harm" then yes, there is
harm in using -ldl when building with a static libcrypto.

Personally I consider it harm increasing overall system load by building OpenSSH
with a static libcrypto, that's why I built libcrypto as shared object. Name it
attitude. :-)

I didn't want to call it nonsense to use my trivial patch and always build with
-ldl under ReliantUnix (I need it anyway). I just wanted to say I would consider
it clever to avoid a superfluous -ldl when it's just that: superfluous.
Comment 4 Darren Tucker 2003-09-25 21:03:55 AEST
OK then, sounds like it's not worth the hassle of auto-detecting the need for
-ldl.  Any objections to patch id #462?
Comment 5 Darren Tucker 2003-10-07 20:37:56 AEST
Similar patch (using AC_CHECK_LIB) applied, thanks.  Please try tomorrow's
snapshot to see if it works for you.
Comment 6 Damien Miller 2004-04-14 12:24:19 AEST
Mass change of RESOLVED bugs to CLOSED