From: Mathieu Desnoyers Date: Fri, 25 Mar 2022 20:42:12 +0000 (-0400) Subject: Fix: Remove liblttng-ctl.so dependency on liburcu-cds.so and liburcu-common.so X-Git-Tag: v2.12.10~1 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=de98d3712fd1af58c61d8690652953e9a3305407;p=lttng-tools.git 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 Signed-off-by: Jérémie Galarneau Change-Id: I4ce4289f4022bd6f27f656639a451cb39b7c9a9e --- diff --git a/configure.ac b/configure.ac index 541b0f9ad..4daf31f52 100644 --- a/configure.ac +++ b/configure.ac @@ -502,7 +502,7 @@ AC_CHECK_DECL([rcu_thread_online], [], [AC_MSG_ERROR([WRONG_LIBURCU_MSG])], [[#include ]]) AC_CHECK_DECL([caa_likely], [], [AC_MSG_ERROR([WRONG_LIBURCU_MSG])], [[#include ]]) -AC_CHECK_LIB([urcu-cds], [_cds_lfht_new], [], +AC_CHECK_LIB([urcu-cds], [_cds_lfht_new], [:], [AC_MSG_ERROR([WRONG_LIBURCU_MSG])]) #Function added in urcu 0.7.0