build: don't statically link static libraries with other static libraries (1)

When we link static libraries together, there must be no duplicate
symbols.

Since we have a lot of static/intermediate libraries, getting this right
is complicated and sometimes leads to ugly solutions.

As a new rule: don't let static libraries link with other static
libraries. Only binaries and libnm/libnm.la should explicitly link
with all the static libraries that they require.

There are exceptions: "src/libNetworkManager.la" and "libnm/liblibnm.la".
These are static, internal libraries, but they are basically *everything*
that ends up in "src/NetworkManager" and "libnm/libnm.la", respecitively.
Hence, these static libraries also link against other static libraries.
Another exception to this rule is "src/libNetworkManagerTest.la", for
similar reasons.
This commit is contained in:
Thomas Haller 2019-05-15 10:39:08 +02:00
parent d8eb9e7515
commit 1a24f3ae8d

View file

@ -283,10 +283,6 @@ else
shared_libnacd_la_SOURCES += shared/n-acd/src/n-acd-bpf-fallback.c
endif
shared_libnacd_la_LIBADD = \
shared/libcrbtree.la \
$(NULL)
###############################################################################
noinst_LTLIBRARIES += shared/nm-std-aux/libnm-std-aux.la
@ -2148,6 +2144,7 @@ src_libNetworkManager_la_LIBADD = \
src/libnm-systemd-core.la \
shared/systemd/libnm-systemd-shared.la \
shared/libnacd.la \
shared/libcrbtree.la \
$(GLIB_LIBS) \
$(LIBUDEV_LIBS) \
$(SYSTEMD_LOGIN_LIBS) \