Am 30.06.2010 13:49, schrieb Jonas Smedegaard:
I do not understand in what situations -dev packages need not depend
on -dev packages corresponding to what packages the library links

I'll try, although my knowlegde in this subject is also rather limited (i.e. whose isn't?). ;)

against. As I see it, this is contained in 1st paragraph of Debian
Policy ยง8.4.
Perhaps if you elaborate a bit more on your libavcodec-dev example, I
may better understand your point?

The section of Debian Policy that you quote deals with shared libraries. I'll try to explain my concern in an example a bit less complex than libavcodec-dev:

A shared library "libfoo0" makes use of symbols of another library "liba0" and is thus linked against it. However, in our case libfoo0 does not export (parts of) liba's symbols via its own interface (i.e. it does not reference liba's headers in its own exported headers). That is, if an application "bar" uses symbols from libfoo0 that in turn make use of symbols from liba0 - but bar does not use the symbols from liba0 directly - then there is no need to link bar against liba0. It is sufficient to link bar against libfoo0 which in turn is linked against liba0. As a consequence, the application does not need to build-depend on the liba-dev package.

For static linking, however, the situation is a bit different: Since you build the whole of libfoo.a into the bar object, instead of only making bar link against libfoo0, you also have to build the whole of the libraries that libfoo.a uses symbols from into the bar object. In this case you need access to all the static variants of the libraries that libfoo references (in our example liba.a) and thus have to install the corresponding -dev packages, e.g. liba-dev.


Back to the libavcodec example:
If you want to use libavcodec for en- or decoding of multimedia material, you simply use some of the functions it exports in its header files in the libavcodec-dev package and link your application against the shared libavcodec52.so library. The libavcodec52 library package will pull in all the required codec libraries that libavcodec uses internally, but as an application developer you do not have to care which library libavcodec uses to de- or encode certain types of media. That's why the libavcodec-dev package has no further *dependencies* except for libavutil-dev, of which it uses some symbols in its exported interface, i.e. in its own header files.

On the other hand, libavcodec-dev *suggests* some other -dev packages that are/were usefull for static linking, i.e. that need to be built into your application alongside libavdcodec.a in order to work. However, the packages in this list once were hard dependencies until we (i.e. Sam and Loic IIRC) decided to not support static linking in this form anymore and demote them to suggests a few years ago. The list has not been updated since then, though, and nobody has complained so far. ;)


The difference between both scenarios is also well displayed by the different fields Libs and Libs.private in .pc files. I don't know if .la files also do this distinction, but there is a similar field in them called dependency_libs.


I hope I was able to bring some light into this subject. However, I will not claim that everything I wrote here is perfectly corrent. ;)

 - Fabian




--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to