Fix: Remove liblttng-ctl.so dependency on liburcu-cds.so and liburcu-common.so
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 25 Mar 2022 20:42:12 +0000 (16:42 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 28 Mar 2022 18:54:58 +0000 (14:54 -0400)
commitde98d3712fd1af58c61d8690652953e9a3305407
tree8f267d390b1fabccb670adf1a0305b0ce3592da9
parent50ffaef1589115e77ee857409ea5d5c081fe26e8
Fix: Remove liblttng-ctl.so dependency on liburcu-cds.so and liburcu-common.so

Observed Issue
==============

After splitting libcommon into lgpl/gpl convenience libraries,
liblttng-ctl.so still depends on liburcu-cds.so and liburcu-common.so.

Cause
=====

The default behavior, for AC_CHECK_LIB when the `action-if-found` is NOT
defined, is to prepend the library to LIBS. [1]

"
If action-if-found is not specified, the default action prepends
-llibrary to LIBS and defines ‘HAVE_LIBlibrary’ (in all capitals).
"

It is important to note that the LIBS variable is used for ALL linking.

This is normally not a problem for most distribution since they force
the use of `--as-needed` at the toolchain level (gcc specs) (for example
debian [2]). One could also pass the `--as-needed` flag manually but
libtool reorganize flags in the case of shared object creation [3].

In our case, we always explicitly state the dependencies via the *_LIBADD
automake clause. We do not rely on the LIBS variable.

The current configure.ac does define what seems to be `empty but
defined` clause for the `action-if-found` as "[]". This is not a valid
"empty but defined" `action-if-find` clause and end up generating the
default behavior as defined in [1].

This leads to unnecessary dependencies for most of the shared object, at
link time, generated when using a distro that do not enforce the
`--as-needed` flag on linking.

Solution
========

Define an actual no-op shell operation `:` for the `action-if-found`
parameter.

Known drawbacks
=========

None.

References
==========
[1] https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Libraries.html
[2] https://salsa.debian.org/toolchain-team/gcc/-/blob/master/debian/patches/gcc-as-needed.diff
[3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=347650

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I4ce4289f4022bd6f27f656639a451cb39b7c9a9e
configure.ac
This page took 0.025068 seconds and 4 git commands to generate.