[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#191369: [PROPOSAL] encourage packagers to systematically prevent mis-linked libraries



Hi Lars,

On Wed, Apr 30, 2003 at 09:34:40AM +0300, Lars Wirzenius wrote:
> On ke, 2003-04-30 at 06:20, Steve Langasek wrote:
> > It happens with unfortunate frequency that a shared library in the
> > archive will be built without linking against all the other libraries it
> > uses symbols from.

> Please allow me a stupid question early in the morning. This linking
> issue seems to be something that can be checked automatically. Does
> lintian check for it? Having such a check would probably be more
> effective than a policy change in getting things fixed, though the
> policy change sounds good too. (I'm not familiar enough with the issue,
> however, to formally second.)

Yes, it could be checked automatically, though I'm having a hard time
choosing a least-inelegant solution for this. :-)  The /elegant/
solution is to let GNU ld handle it.

Here is a first approximation of the check in shell:

OURLIB=/path/to/libfoo.so.X
MISSING=""
NEEDED=""
for LIB in `objdump -p $OURLIB | grep NEEDED | awk '{print $2}'`
do
	NEEDED="$NEEDED `ldd $OURLIB | grep "\b$LIB" | awk '{print $3}'`"
done
for SYM in `objdump -T $OURLIB | grep '*UND*'|cut -b46-`
do
	objdump -T $NEEDED | grep -q $SYM || MISSING="$MISSING $SYM"
done
if [ -n "$MISSING" ]; then
	echo "Unresolved symbols: $MISSING"
fi

Hmm, if I run this against libXft.so for bug #186042, I find three
missing libraries. :)  But it takes forever.

-- 
Steve Langasek
postmodern programmer

Attachment: pgpTWIRFqilq4.pgp
Description: PGP signature


Reply to: