Subject: bug#13920: link_all_deps and indirect dependencies

From: "Gary V. Vaughan" <[email-masked]>
Date: Mon, 11 Mar 2013 12:34:42 +0700

On 11 Mar 2013, at 05:10, Дилян Палаузов <[email-masked]> wrote:
> Hello,

Hi,

> in my project, I have program A that dynamically links with library B (library B is mentioned as DT_NEEDED in program A), and library B dynamically links with library C (library C is mentioned as DT_NEEDED in library B, and under dependency_libs in libraryB.la).
> 
> --> If I want to use a function from library C in program A, am I supposed to list (in Makefile.am) that program A depends on library C, or can I rely on the fact, that program A loads library B and library B loads library C, thus it is not necessary to link explicitly program A with library C?

Best practice dictates that you should list all of the libraries whose APIs you use.  So if you use an API from C in A, then A has an explicit dependency on C.

Libtool doesn't enforce this though, so if you prefer to be sloppy about dependencies it will still link correctly.

> Under Debian, libtool is patched to have link_all_deplibs=no, on other systems link_all_deplibs is unknown/yes.  When link_all_deplibs is yes, I do not have to link program A explicitly with library C; when link_all_deplibs is no, I have to link explicitly.

Debian have broken one of the core features of libtool with that patch.  If you prefer to use the debian libtool, then you will need to list all your deplibs explicitly, since they have turned off the feature that tracks them for you. Alternatively, you can install a fully working libtool from gnu.org.

Debian and GNU disagree about the benefits of link_all_deplibs, and we have agreed to disagree.  There's no need to dig up the old arguments about the relative benefits of either approach, where both sides are already happy to co-exist peacefully :)

> Program A, library B and library C are in the control of the same person, so the dependency on libC in libB is ensured.
> 
> According to the Debian maintainer of the libtool package, bugs.debian.org/cgi-bin/bugreport.cgi?bug=702737 , libtool's documentation shall state (or states, but I don't find where), that program A must explicitly link with library C.

Agreed.

Cheers,
-- 
Gary V. Vaughan (gary AT gnu DOT org)