From 9c06ee2277e430a5a76dcdbc8559d62037b856cf Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Tue, 20 Oct 2026 23:26:26 +0100 Subject: [PATCH] meson: skip symbol analysis when tests are disabled or build type is not dev (#44322) The libshared-unused-symbols test references every executable, including tests and fuzzers whose build_by_default is false. Meson 1.3 adds test prerequisites to Ninja's all target, so registering this test pulls those executables into a build configured even if -Dtests=false. The resulting executables fail to link because src/shared/tests.c is excluded from libsystemd-shared when tests are disabled. Follow-up for 3f0fc9321932f8e0e35922586c7369eec557793d (cherry picked from commit dac6eb0a24ac34dc3bdf89f0aaf27187e6465643) (cherry picked from commit d3ccae621ec397ffce1dbe89173b78c8a0561345) --- meson.build | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/meson.build b/meson.build index 69f5f1ec3af..0bd1fbda2f3 100644 --- a/meson.build +++ b/meson.build @@ -2685,17 +2685,19 @@ if spatch.found() endforeach endif -symbol_analysis_exes = [] -foreach name, exe : executables_by_name - symbol_analysis_exes += exe -endforeach +if want_tests != 'false' and conf.get('BUILD_MODE_DEVELOPER') == 1 + symbol_analysis_exes = [] + foreach name, exe : executables_by_name + symbol_analysis_exes += exe + endforeach -test( - 'libshared-unused-symbols', - find_unused_library_symbols_py, - suite : 'unused-symbols', - args : [libshared, libcore] + nss_targets + pam_targets + symbol_analysis_exes, -) + test( + 'libshared-unused-symbols', + find_unused_library_symbols_py, + suite : 'unused-symbols', + args : [libshared, libcore] + nss_targets + pam_targets + symbol_analysis_exes, + ) +endif run_target( 'check-api-docs',