After Ian Lance Taylor from cygnus has confirmed that GNU ld for ELF
will continue to behave that way, I'd like to pass this to the maintainer
of debian packages.

The latest packages I've compiled and seen some superfluous "-lfoo" are:
man-2.3.10-6:
manpath         (-lgdbm)
zsoelim         (-lgdbm)

git-4.3.7-5:
gitview         (-lreadline)
gitcmp          (-lreadline -lncurses)
gitkeys         (-lreadline -lncurses)
gitmatch        (-lreadline -lncurses)
gitwipe         (-lreadline -lncurses)

perl-5.002-3:
a2p             (-lndbm -lgdbm -ldbm -ldb -ldl -lm -lc -lbsd) 

mfg
Rolf Rossius

---------- Forwarded message ----------
Date: Tue, 19 Dec 1995 03:53:35 +0100 (MET)
From: roro <[EMAIL PROTECTED]>
To: David Engel <[EMAIL PROTECTED]>
Subject: Useless use of "-lfoo" 

A peculiarity of the link editor for ELF (in contrast to aout)
will not harm, but sometimes do unwanted things for the resulting
binary.

I have noticed this in the package git and suspect there are others.

The configuration and build process for a packages often collects the 
names of the needed libraries and add "-lfoo -lbar -lbaz" to the link
flags for *all* binaries.  Even if no functions or objects from libbar 
(a shared lib) are required for a binary, the soname of libbar
"libbar.so.x" is noted in the bin and this file is necessary at runtime.

ELF:

[EMAIL PROTECTED]:tty6:~/tmp$ gcc t.c
[EMAIL PROTECTED]:tty6:~/tmp$ ldd a.out
        libc.so.5 => /lib/libc.so.5.2.18
[EMAIL PROTECTED]:tty6:~/tmp$ gcc t.c -lm
[EMAIL PROTECTED]:tty6:~/tmp$ ldd a.out
        libm.so.5 => /lib/libm.so.5.0.5
        libc.so.5 => /lib/libc.so.5.2.18


For the "aout" format, an additional "-lm" makes no difference
(assuming libm is not needed by t.c):

[EMAIL PROTECTED]:tty6:~/tmp$ gcc -b i486-linuxaout t.c
[EMAIL PROTECTED]:tty6:~/tmp$ ldd a.out
        libc.so.4 (DLL Jump 4.7pl5) => /lib/libc.so.4.7.5
[EMAIL PROTECTED]:tty6:~/tmp$ gcc -b i486-linuxaout t.c -lm
[EMAIL PROTECTED]:tty6:~/tmp$ ldd a.out
        libc.so.4 (DLL Jump 4.7pl5) => /lib/libc.so.4.7.5


I don't know whether it is *that* important.  But should the debian 
package maintainer not be better aware of this fact, be encouraged
to adjust the link flags and maybe report to upstream maintainer?
What do you think?

mfg
Rolf Rossius



Reply via email to