Libs with applications

Matthias Clasen mclasen at redhat.com
Tue Nov 22 13:42:25 UTC 2011


On Tue, 2011-11-22 at 11:46 +0100, Karel Zak wrote:
> 
> 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.

You have to be careful when you read documentation as well.
That 'shall' sentence is a bit of a propaganda piece. In reality, things
are not as black-and-white. 

> $ 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 :-)

Well, the pkg-config output effectively states that they are.

And changing it now will cause breakage. We already experienced that
when I removed the -lpng12 and -lm from the gdk-pixbuf pc file.



More information about the devel mailing list