Indirect dependencies

Tollef Fog Heen tfheen at
Sun Oct 16 22:57:12 PDT 2005

* "Julio M. Merino Vidal" 

| The real problem I'm facing comes from GTK, though, and it is the
| other way around.  In 2.8, Cairo has been added as a dependency.
| GTK 2.8 is binary compatible with older versions.

Yes, that's correct, but you're getting the compatibility the wrong
way around.  GTK 2.8 has functions which doesn't exist in 2.0, say,
the «new» (it's not that new any more. :-) file chooser.  What the
compatibility means is applications linked against gtk 2.6 or 2.0 will
run with GTK 2.8, not the other way around.

If this wasn't the case, the only changes which could be done from 2.0
to 2.8 would have been bugfixes.  No news APIs or anything like that.

| Now consider I have a program X that requires GTK 2.6.  I build X
| on my system against 2.8 and pass the resulting binary to a friend
| who still has 2.6.  He will be unable to run the program, not
| because incompatibilities in GTK but because the binary will refer
| to Cairo, which may not be installed on the target system.

This is a fairly hard problem, since pkg-config doesn't know if you
use a cairo function (GTK has functions to give you a CairoCanvas,
IIRC) and this works this way for historical reasons and I figured
having stuff still build was more important than being pedantically

If you disagree with me, you might want to chat with James Henstridge,
with whom I had more or less this same argument (and I had your side)
this spring and he convinced me.

| so, all I should be using to link against gtk are the flags shown in Libs,
| not the flags provided by all the packages listed in Requires.
| Is it there something wrong in the gtk pkg-config file?  If not, do you
| feel this issue could be addressed in pkg-config in some way?

One can argue that gtk should have the cairo dependency in
Requires.private, which gives you the behaviour you're after, but you
can also argue otherwise, since gtk can expose cairo canvases which
means you'll blow up in spectacular ways if you just link against gtk
and you then try to run with a newer gtk linked against a newer cairo
where structs have other sizes, for instance.

Tollef Fog Heen                                                        ,''`.
UNIX is user friendly, it's just picky about who its friends are      : :' :
                                                                      `. `' 

More information about the pkg-config mailing list