Libs with applications

Karel Zak kzak at redhat.com
Tue Nov 22 10:46:40 UTC 2011


On Sun, Nov 20, 2011 at 02:33:34PM -0500, Steve Grubb wrote:
> # ldd /usr/bin/msntest | wc -l
> 20
> # ldd /usr/lib64/libmsn.so.0.3.0 | wc -l
> 9

 Please, be careful. ldd(1) prints recursively all dependencies.

 $ ldd  /usr/bin/msntest | wc -l                                      
 20

 $ readelf -a /usr/bin/msntest | grep NEEDED | wc -l
 8

It means that the /usr/bin/msntest depends on 8 libraries only. 

> I didn't test all of them, but the extra dependencies are unneeded.

Yes, typical problem is (usually) completely broken .pc (pkg-config)
file. My experience is that developers don't have a clue about
'Requires.private' pkg-config field and they add all libraries to
'Requires' or 'Libs', so then binaries are linked with many
unnecessary libraries (possible workaround is --as-needed ld(1)
option).

man pkg-config:
   In the  situation where each .pc file corresponds to a library,
   Requires.private shall be used exclusively to specify the 
   dependencies between the libraries.

$ pkg-config --libs gtk+-3.0 
-pthread -lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangoft2-1.0
-lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpng12 -lm -lcairo-gobject -lcairo
-lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0
-lgthread-2.0 -lrt -lglib-2.0  

... I don't believe that gtk ABI contains symbols from all this
libraries :-)

    Karel

-- 
 Karel Zak  <kzak at redhat.com>
 http://karelzak.blogspot.com


More information about the devel mailing list