From: Daan De Meyer Date: Fri, 15 May 2026 09:54:53 +0000 (+0000) Subject: meson: drop libdl, threads, and librt dependencies X-Git-Tag: v261-rc1~104^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a14adac42361d1ebaf6c7c2a8a680939f2d1cd64;p=thirdparty%2Fsystemd.git meson: drop libdl, threads, and librt dependencies Our baseline glibc is 2.34, which merged libdl, libpthread (the dependency('threads') target), and librt into libc. Empty .so/.a stubs remain for backward compatibility with old binaries, but new builds resolve dl_*, pthread_*, mq_*, timer_*, etc. directly from libc. On musl the same libraries are likewise empty stubs. Drop the libdl, threads, and librt entries from every meson.build, and remove the now-stale 'Libs.private: -lrt -pthread' from libudev.pc.in since both flags resolve to empty link-time stubs on glibc 2.34+ and musl. Verified with readelf -d that libsystemd.so, libudev.so, and systemd no longer carry DT_NEEDED entries for libdl/libpthread/librt. --- diff --git a/meson.build b/meson.build index b26ef7979c9..8d5ee4f5792 100644 --- a/meson.build +++ b/meson.build @@ -978,10 +978,7 @@ endif ##################################################################### -threads = dependency('threads') -librt = cc.find_library('rt') libm = cc.find_library('m') -libdl = cc.find_library('dl') # Header presence check only — dgettext itself is resolved via dlopen_libintl() at runtime, so we never # link against libintl. On glibc dgettext lives in libc; on musl gettext-dev provides libintl.h alongside @@ -1758,9 +1755,7 @@ libsystemd = shared_library( link_with : [libc_wrapper_static, libbasic_static], link_whole : [libsystemd_static], - dependencies : [librt, - threads, - userspace], + dependencies : [userspace], link_depends : libsystemd_sym, install : true, install_tag: 'libsystemd', @@ -1779,14 +1774,11 @@ if static_libsystemd != 'false' install_tag: 'libsystemd', install_dir : libdir, pic : static_libsystemd_pic, - dependencies : [libdl, - libgcrypt_cflags, + dependencies : [libgcrypt_cflags, liblz4_cflags, libm, - librt, libxz_cflags, libzstd_cflags, - threads, userspace], c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC'])) @@ -1804,8 +1796,7 @@ libudev = shared_library( '-Wl,--version-script=' + libudev_sym_path], link_with : [libsystemd_static], link_whole : libudev_basic, - dependencies : [threads, - userspace], + dependencies : [userspace], link_depends : libudev_sym, install : true, install_tag: 'libudev', @@ -1922,10 +1913,6 @@ nss_template = { libshared_static, libbasic_static, ], - 'dependencies' : [ - librt, - threads, - ], 'install' : true, 'install_tag' : 'nss', 'install_dir' : libdir, @@ -1938,10 +1925,7 @@ pam_template = { libsystemd_static, libshared_static, ], - 'dependencies' : [ - libpam_cflags, - threads, - ], + 'dependencies' : libpam_cflags, 'install' : true, 'install_tag' : 'pam', 'install_dir' : pamlibdir, diff --git a/src/basic/meson.build b/src/basic/meson.build index f847b175b61..9007cff1781 100644 --- a/src/basic/meson.build +++ b/src/basic/meson.build @@ -212,15 +212,12 @@ libbasic_static = static_library( include_directories : basic_includes, implicit_include_directories : false, dependencies : [libbzip2_cflags, - libdl, libgcrypt_cflags, liblz4_cflags, libm, - librt, libxz_cflags, libz_cflags, libzstd_cflags, - threads, userspace], c_args : ['-fvisibility=default'], build_by_default : false) diff --git a/src/core/meson.build b/src/core/meson.build index 2bd8170c6a2..8971800bcba 100644 --- a/src/core/meson.build +++ b/src/core/meson.build @@ -148,13 +148,10 @@ libcore_static = static_library( dependencies : [libaudit_cflags, libbpf_cflags, libcryptsetup_cflags, - libdl, libm, libmount_cflags, - librt, libseccomp_cflags, libselinux_cflags, - threads, userspace], build_by_default : false) diff --git a/src/coredump/meson.build b/src/coredump/meson.build index 355993d09ef..b0753d86fa8 100644 --- a/src/coredump/meson.build +++ b/src/coredump/meson.build @@ -30,7 +30,6 @@ common_dependencies = [ liblz4_cflags, libxz_cflags, libzstd_cflags, - threads, ] executables += [ diff --git a/src/creds/meson.build b/src/creds/meson.build index dc4a5a28ae3..c18fe2ec890 100644 --- a/src/creds/meson.build +++ b/src/creds/meson.build @@ -12,7 +12,6 @@ executables += [ 'dependencies' : [ libmount_cflags, libopenssl_cflags, - threads, ], }, ] diff --git a/src/cryptenroll/meson.build b/src/cryptenroll/meson.build index 8213a0e6725..aa789c0a071 100644 --- a/src/cryptenroll/meson.build +++ b/src/cryptenroll/meson.build @@ -22,7 +22,6 @@ executables += [ 'sources' : systemd_cryptenroll_sources, 'dependencies' : [ libcryptsetup_cflags, - libdl, libfido2_cflags, libopenssl_cflags, libp11kit_cflags, diff --git a/src/home/meson.build b/src/home/meson.build index 64c62f1dddf..b724517ae9c 100644 --- a/src/home/meson.build +++ b/src/home/meson.build @@ -67,10 +67,7 @@ executables += [ 'dbus' : true, 'sources' : systemd_homed_sources, 'extract' : systemd_homed_extract_sources, - 'dependencies' : [ - libopenssl_cflags, - threads, - ], + 'dependencies' : libopenssl_cflags, }, libexec_template + { 'name' : 'systemd-homework', @@ -81,7 +78,6 @@ executables += [ libfdisk_cflags, libopenssl_cflags, libp11kit_cflags, - threads, ], }, executable_template + { @@ -91,10 +87,8 @@ executables += [ 'extract' : homectl_extract, 'objects' : ['systemd-homed'], 'dependencies' : [ - libdl, libopenssl_cflags, libp11kit_cflags, - threads, ], }, test_template + { @@ -113,10 +107,6 @@ modules += [ 'name' : 'pam_systemd_home', 'conditions' : ['HAVE_PAM'], 'sources' : pam_systemd_home_sources, - 'dependencies' : [ - libpam_cflags, - threads, - ], 'version-script' : meson.current_source_dir() / 'pam_systemd_home.sym', }, ] diff --git a/src/import/meson.build b/src/import/meson.build index c2879c5d843..f133f276b4b 100644 --- a/src/import/meson.build +++ b/src/import/meson.build @@ -17,7 +17,6 @@ executables += [ 'import-common.c', 'qcow2-util.c', ), - 'dependencies' : threads, }, libexec_template + { 'name' : 'systemd-pull', diff --git a/src/journal-remote/meson.build b/src/journal-remote/meson.build index f6aa71349c2..22ac8703b55 100644 --- a/src/journal-remote/meson.build +++ b/src/journal-remote/meson.build @@ -25,7 +25,6 @@ common_deps = [ liblz4_cflags, libxz_cflags, libzstd_cflags, - threads, ] executables += [ diff --git a/src/journal/meson.build b/src/journal/meson.build index 1f40e9b43b1..75cd7b7a30a 100644 --- a/src/journal/meson.build +++ b/src/journal/meson.build @@ -72,7 +72,6 @@ executables += [ libselinux_cflags, libxz_cflags, libzstd_cflags, - threads, ], }, libexec_template + { @@ -86,7 +85,6 @@ executables += [ 'public' : true, 'sources' : files('cat.c'), 'objects' : ['systemd-journald'], - 'dependencies' : [threads], }, executable_template + { 'name' : 'journalctl', @@ -94,11 +92,9 @@ executables += [ 'sources' : journalctl_sources, 'link_with' : journalctl_link_with, 'dependencies' : [ - libdl, liblz4_cflags, libxz_cflags, libzstd_cflags, - threads, ], }, journal_test_template + { @@ -123,7 +119,6 @@ executables += [ liblz4_cflags, libselinux_cflags, libxz_cflags, - threads, ], }, journal_test_template + { diff --git a/src/libsystemd/meson.build b/src/libsystemd/meson.build index 2c86a231064..b7e11c9bb22 100644 --- a/src/libsystemd/meson.build +++ b/src/libsystemd/meson.build @@ -150,9 +150,7 @@ libsystemd_static = static_library( c_args : libsystemd_c_args, link_with : [libc_wrapper_static, libbasic_static], - dependencies : [threads, - libm, - librt, + dependencies : [libm, userspace], build_by_default : false) @@ -203,20 +201,17 @@ simple_tests += files( libsystemd_tests += [ { 'sources' : files('sd-bus/test-bus-address.c'), - 'dependencies' : threads }, { 'sources' : files('sd-bus/test-bus-benchmark.c'), - 'dependencies' : threads, 'type' : 'manual', }, { 'sources' : files('sd-bus/test-bus-chat.c'), - 'dependencies' : threads, }, { 'sources' : files('sd-bus/test-bus-cleanup.c'), - 'dependencies' : [threads, libseccomp_cflags], + 'dependencies' : libseccomp_cflags, }, { 'sources' : files('sd-bus/test-bus-marshal.c'), @@ -226,28 +221,22 @@ libsystemd_tests += [ libglib_cflags, libgobject_cflags, libm, - threads, ], }, { 'sources' : files('sd-bus/test-bus-objects.c'), - 'dependencies' : threads, }, { 'sources' : files('sd-bus/test-bus-peersockaddr.c'), - 'dependencies' : threads, }, { 'sources' : files('sd-bus/test-bus-queue-ref-cycle.c'), - 'dependencies' : threads, }, { 'sources' : files('sd-bus/test-bus-server.c'), - 'dependencies' : threads, }, { 'sources' : files('sd-bus/test-bus-signature.c'), - 'dependencies' : threads, }, { 'sources' : files('sd-bus/test-bus-track.c'), @@ -255,12 +244,11 @@ libsystemd_tests += [ }, { 'sources' : files('sd-bus/test-bus-watch-bind.c'), - 'dependencies' : threads, 'timeout' : 120, }, { 'sources' : files('sd-device/test-sd-device.c'), - 'dependencies' : [threads, libmount_cflags], + 'dependencies' : libmount_cflags, }, { 'sources' : files('sd-event/test-event.c'), @@ -288,16 +276,13 @@ libsystemd_tests += [ }, { 'sources' : files('sd-resolve/test-resolve.c'), - 'dependencies' : threads, 'timeout' : 120, }, { 'sources' : files('sd-varlink/test-varlink.c'), - 'dependencies' : threads, }, { 'sources' : files('sd-varlink/test-varlink-idl.c'), - 'dependencies' : threads, }, ] diff --git a/src/libudev/libudev.pc.in b/src/libudev/libudev.pc.in index 6541bcb1ab6..72d46ffc505 100644 --- a/src/libudev/libudev.pc.in +++ b/src/libudev/libudev.pc.in @@ -16,5 +16,4 @@ Name: libudev Description: Library to access udev device information Version: {{PROJECT_VERSION}} Libs: -L${libdir} -ludev -Libs.private: -lrt -pthread Cflags: -I${includedir} diff --git a/src/locale/meson.build b/src/locale/meson.build index 1b97628abbc..2f99bb8d807 100644 --- a/src/locale/meson.build +++ b/src/locale/meson.build @@ -18,7 +18,6 @@ localectl_sources = files('localectl.c') # specify where the headers are. if conf.get('HAVE_XKBCOMMON') == 1 libxkbcommon_deps = [ - libdl, libxkbcommon_cflags, ] else diff --git a/src/login/meson.build b/src/login/meson.build index 390960d5f6c..44325ccd7c0 100644 --- a/src/login/meson.build +++ b/src/login/meson.build @@ -48,9 +48,6 @@ executables += [ 'dbus' : true, 'sources' : systemd_logind_sources, 'extract' : systemd_logind_extract_sources, - 'dependencies' : [ - threads, - ], }, executable_template + { 'name' : 'loginctl', @@ -60,7 +57,6 @@ executables += [ liblz4_cflags, libxz_cflags, libzstd_cflags, - threads, ], }, executable_template + { @@ -79,7 +75,6 @@ executables += [ test_template + { 'sources' : files('test-login-tables.c'), 'objects' : ['systemd-logind'], - 'dependencies' : threads, }, test_template + { 'sources' : files('test-session-properties.c'), diff --git a/src/machine/meson.build b/src/machine/meson.build index 13756cb8a1b..fc16e9f5c5f 100644 --- a/src/machine/meson.build +++ b/src/machine/meson.build @@ -36,13 +36,11 @@ executables += [ liblz4_cflags, libxz_cflags, libzstd_cflags, - threads, ], }, test_template + { 'sources' : files('test-machine-tables.c'), 'objects' : ['systemd-machined'], - 'dependencies': threads, }, ] diff --git a/src/network/meson.build b/src/network/meson.build index 03191024925..23f6f3a4fe5 100644 --- a/src/network/meson.build +++ b/src/network/meson.build @@ -188,7 +188,6 @@ network_fuzz_template = fuzz_template + { libsystemd_network, ], 'objects' : ['systemd-networkd'], - 'dependencies' : threads, 'include_directories' : network_includes, } @@ -204,7 +203,6 @@ executables += [ libsystemd_network, networkd_link_with, ], - 'dependencies' : threads, 'bpf_programs': [ 'sysctl-monitor', ] @@ -240,11 +238,9 @@ executables += [ }, network_test_template + { 'sources' : files('test-network-tables.c'), - 'dependencies' : threads, }, network_test_template + { 'sources' : files('test-network.c'), - 'dependencies' : threads, }, network_test_template + { 'sources' : files('test-networkd-address.c'), diff --git a/src/nsresourced/meson.build b/src/nsresourced/meson.build index 881fd911e41..1654e1766b1 100644 --- a/src/nsresourced/meson.build +++ b/src/nsresourced/meson.build @@ -24,13 +24,11 @@ executables += [ 'name' : 'systemd-nsresourced', 'sources' : systemd_nsresourced_sources, 'extract' : systemd_nsresourced_extract_sources, - 'dependencies' : threads, 'bpf_programs': ['userns-restrict'], }, libexec_template + { 'name' : 'systemd-nsresourcework', 'sources' : systemd_nsresourcework_sources, - 'dependencies' : threads, 'objects' : ['systemd-nsresourced'], 'bpf_programs': ['userns-restrict'], }, diff --git a/src/portable/meson.build b/src/portable/meson.build index 3029ad41777..0bd5d1c3ce2 100644 --- a/src/portable/meson.build +++ b/src/portable/meson.build @@ -32,7 +32,6 @@ executables += [ libcryptsetup_cflags, libmount_cflags, libselinux_cflags, - threads, ], }, executable_template + { @@ -40,7 +39,6 @@ executables += [ 'public' : true, 'sources' : files('portablectl.c'), 'link_with' : portabled_link_with, - 'dependencies' : threads, }, ] diff --git a/src/pstore/meson.build b/src/pstore/meson.build index d6bb9257897..a94f1b1e884 100644 --- a/src/pstore/meson.build +++ b/src/pstore/meson.build @@ -12,7 +12,6 @@ executables += [ liblz4_cflags, libxz_cflags, libzstd_cflags, - threads, ], }, ] diff --git a/src/repart/meson.build b/src/repart/meson.build index 9b89f56f7a0..bb5b63be054 100644 --- a/src/repart/meson.build +++ b/src/repart/meson.build @@ -17,7 +17,6 @@ executables += [ libfdisk_cflags, libmount_cflags, libopenssl_cflags, - threads, ], }, executable_template + { @@ -35,7 +34,6 @@ executables += [ libfdisk_cflags, libmount_cflags, libopenssl_cflags, - threads, ], }, ] diff --git a/src/resolve/meson.build b/src/resolve/meson.build index 5802889746e..36503133555 100644 --- a/src/resolve/meson.build +++ b/src/resolve/meson.build @@ -72,7 +72,6 @@ resolve_common_template = { libidn2_cflags, libopenssl_cflags, libm, - threads, ], } diff --git a/src/shared/meson.build b/src/shared/meson.build index ce96ce3025c..55cf8364d37 100644 --- a/src/shared/meson.build +++ b/src/shared/meson.build @@ -383,8 +383,7 @@ shared_sources += [dns_type_from_name_inc, dns_type_to_name_inc] libshared_name = 'systemd-shared-@0@'.format(shared_lib_tag) -libshared_deps = [threads, - libacl_cflags, +libshared_deps = [libacl_cflags, libapparmor_cflags, libarchive_cflags, libaudit_cflags, @@ -393,7 +392,6 @@ libshared_deps = [threads, libcrypt_cflags, libcryptsetup_cflags, libcurl_cflags, - libdl, libdw_cflags, libelf_cflags, libfdisk_cflags, @@ -410,7 +408,6 @@ libshared_deps = [threads, libpcre2_cflags, libpwquality_cflags, libqrencode_cflags, - librt, libseccomp_cflags, libselinux_cflags, libxenctrl_cflags, diff --git a/src/socket-activate/meson.build b/src/socket-activate/meson.build index a4d18b58a8d..628dbe79ffc 100644 --- a/src/socket-activate/meson.build +++ b/src/socket-activate/meson.build @@ -5,6 +5,5 @@ executables += [ 'name' : 'systemd-socket-activate', 'public' : true, 'sources' : files('socket-activate.c'), - 'dependencies' : threads, }, ] diff --git a/src/socket-proxy/meson.build b/src/socket-proxy/meson.build index 52d63a8440c..1106b445e9c 100644 --- a/src/socket-proxy/meson.build +++ b/src/socket-proxy/meson.build @@ -5,6 +5,5 @@ executables += [ 'name' : 'systemd-socket-proxyd', 'public' : true, 'sources' : files('socket-proxyd.c'), - 'dependencies' : threads, }, ] diff --git a/src/systemctl/meson.build b/src/systemctl/meson.build index 2ce11c8f48d..882704c9d7d 100644 --- a/src/systemctl/meson.build +++ b/src/systemctl/meson.build @@ -58,7 +58,6 @@ executables += [ liblz4_cflags, libxz_cflags, libzstd_cflags, - threads, ], 'install_tag' : 'systemctl', }, diff --git a/src/sysupdate/meson.build b/src/sysupdate/meson.build index 0cfe22f5283..da554ddcc3d 100644 --- a/src/sysupdate/meson.build +++ b/src/sysupdate/meson.build @@ -30,7 +30,6 @@ executables += [ 'dependencies' : [ libfdisk_cflags, libopenssl_cflags, - threads, ], }, libexec_template + { @@ -38,7 +37,6 @@ executables += [ 'dbus' : true, 'conditions' : ['ENABLE_SYSUPDATED'], 'sources' : files('sysupdated.c'), - 'dependencies' : threads, }, executable_template + { 'name' : 'updatectl', diff --git a/src/test/meson.build b/src/test/meson.build index c8279bc7514..b581de293b3 100644 --- a/src/test/meson.build +++ b/src/test/meson.build @@ -223,10 +223,8 @@ simple_tests += files( common_test_dependencies = [ libmount_cflags, - librt, libseccomp_cflags, libselinux_cflags, - threads, ] executables += [ @@ -303,14 +301,13 @@ executables += [ ], }, test_template + { - # only static linking apart from libdl, to make sure that the - # module is linked to all libraries that it uses. + # only static linking, to make sure that the module is linked + # to all libraries that it uses. 'sources' : files('test-dlopen.c'), 'link_with' : [ libc_wrapper_static, libbasic_static, ], - 'dependencies' : libdl, 'install' : false, 'type' : 'manual', }, @@ -359,10 +356,7 @@ executables += [ test_template + { 'sources' : files('test-libmount.c'), 'conditions' : ['HAVE_LIBMOUNT'], - 'dependencies' : [ - libmount_cflags, - threads, - ], + 'dependencies' : libmount_cflags, }, test_template + { 'sources' : files('test-loopback.c'), @@ -378,7 +372,6 @@ executables += [ }, test_template + { 'sources' : files('test-pressure.c'), - 'dependencies' : threads, }, test_template + { 'sources' : files('test-mount-util.c'), @@ -398,17 +391,13 @@ executables += [ test_template + { 'sources' : files('test-nss-hosts.c'), 'extract' : files('nss-test-util.c'), - 'dependencies' : [ - libdl, - libseccomp_cflags, - ], + 'dependencies' : libseccomp_cflags, 'conditions' : ['ENABLE_NSS'], 'timeout' : 120, }, test_template + { 'sources' : files('test-nss-users.c'), 'objects' : ['test-nss-hosts'], - 'dependencies' : libdl, 'conditions' : ['ENABLE_NSS'], }, test_template + { @@ -426,7 +415,6 @@ executables += [ }, test_template + { 'sources' : files('test-process-util.c'), - 'dependencies' : threads, }, test_template + { 'sources' : files('test-progress-bar.c'), @@ -441,7 +429,6 @@ executables += [ }, test_template + { 'sources' : files('test-qrcode-util.c'), - 'dependencies' : libdl, }, test_template + { 'sources' : files('test-random-util.c'), @@ -471,7 +458,6 @@ executables += [ }, test_template + { 'sources' : files('test-set-disable-mempool.c'), - 'dependencies' : threads, }, test_template + { 'sources' : files('test-sizeof.c'), @@ -603,7 +589,6 @@ executables += [ }, core_test_template + { 'sources' : files('test-loop-util.c'), - 'dependencies' : [threads], 'parallel' : false, }, core_test_template + { @@ -611,10 +596,7 @@ executables += [ }, core_test_template + { 'sources' : files('test-namespace.c'), - 'dependencies' : [ - threads, - libmount_cflags, - ], + 'dependencies' : libmount_cflags, }, core_test_template + { 'sources' : files('test-ns.c'), @@ -632,7 +614,6 @@ executables += [ }, core_test_template + { 'sources' : files('test-socket-bind.c'), - 'dependencies' : libdl, 'conditions' : ['BPF_FRAMEWORK'], }, core_test_template + { @@ -666,7 +647,6 @@ executables += [ libbasic_static, libsystemd, ], - 'dependencies' : threads, }, test_template + { 'sources' : files('../libudev/test-udev-device-thread.c'), @@ -675,7 +655,6 @@ executables += [ libbasic_static, libudev, ], - 'dependencies' : threads, }, test_template + { 'sources' : files('../libudev/test-libudev.c'), diff --git a/src/timesync/meson.build b/src/timesync/meson.build index b3072457720..c42fcd3e709 100644 --- a/src/timesync/meson.build +++ b/src/timesync/meson.build @@ -35,10 +35,7 @@ executables += [ 'sources' : timesyncd_sources, 'extract' : timesyncd_extract_sources, 'link_with' : timesyncd_link_with, - 'dependencies' : [ - libm, - threads, - ], + 'dependencies' : libm, }, libexec_template + { 'name' : 'systemd-time-wait-sync', diff --git a/src/udev/meson.build b/src/udev/meson.build index 700a8cc8d5e..7e2435d0fab 100644 --- a/src/udev/meson.build +++ b/src/udev/meson.build @@ -122,7 +122,6 @@ udev_dependencies = [ libblkid_cflags, libkmod_cflags, libmount_cflags, - threads, ] udev_plugin_template = executable_template + { @@ -138,7 +137,6 @@ udev_common_template = { 'dependencies' : [ libacl_cflags, libblkid_cflags, - threads, ], } udev_test_template = test_template + udev_common_template diff --git a/src/userdb/meson.build b/src/userdb/meson.build index a933a4907b3..c25c40bc0ab 100644 --- a/src/userdb/meson.build +++ b/src/userdb/meson.build @@ -5,7 +5,6 @@ executables += [ 'name' : 'systemd-userwork', 'conditions' : ['ENABLE_USERDB'], 'sources' : files('userwork.c'), - 'dependencies' : threads, }, libexec_template + { 'name' : 'systemd-userdbd', @@ -14,13 +13,11 @@ executables += [ 'userdbd-manager.c', 'userdbd.c', ), - 'dependencies' : threads, }, executable_template + { 'name' : 'userdbctl', 'conditions' : ['ENABLE_USERDB'], 'sources' : files('userdbctl.c'), - 'dependencies' : threads, }, ]