From 1c1e7a0bc7977f2cd7c3d8e95a8dc1ffda20b365 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 13 Jul 2026 18:22:17 -0700 Subject: [PATCH] frr: Fix native clippy failing to load libatomic.so.1 frr's configure links libatomic whenever the toolchain merely has it: AC_CHECK_LIB([atomic], [main], [LIBS="$LIBS -latomic"], [], []) This probe only asks whether -latomic links, never whether frr needs a symbol from it. On x86-64 the atomics frr uses are inlined, so the resulting native clippy references no __atomic_* symbol at all, yet still records a DT_NEEDED on libatomic.so.1. Nothing prunes it: ASNEEDED is part of TARGET_LDFLAGS only, so native links get no --as-needed. Nothing can satisfy it either: clippy's RUNPATH points solely into recipe-sysroot-native, there is no libatomic-native, and uninative only rewrites the ELF interpreter. buildtools-extended-tarball ships nativesdk-libatomic, so on hosts using buildtools (Rocky 8, Alma 8, openSUSE on the autobuilder) the probe succeeds at link time while the loader cannot find libatomic later, and the target do_compile dies executing clippy: clippy: error while loading shared libraries: libatomic.so.1: cannot open shared object file: No such file or directory Hosts with a system libatomic in the default loader path, such as Ubuntu with libatomic1 installed, only avoid this by accident. Link native clippy with --as-needed so the unused libatomic dependency is dropped, making the frr-native artifact independent of the build host. Fixes [YOCTO #15590] and [YOCTO #15590] Signed-off-by: Khem Raj --- meta-networking/recipes-protocols/frr/frr_10.6.1.bb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/meta-networking/recipes-protocols/frr/frr_10.6.1.bb b/meta-networking/recipes-protocols/frr/frr_10.6.1.bb index 1cd102f0da..8f53cf68d5 100644 --- a/meta-networking/recipes-protocols/frr/frr_10.6.1.bb +++ b/meta-networking/recipes-protocols/frr/frr_10.6.1.bb @@ -67,6 +67,14 @@ LDFLAGS:append:mipsel = " -latomic" LDFLAGS:append:powerpc = " -latomic" LDFLAGS:append:riscv32 = " -latomic" +# configure links -latomic whenever the toolchain merely has it +# (AC_CHECK_LIB([atomic],[main])) rather than when it is needed. buildtools ships +# libatomic, so clippy gets a DT_NEEDED that the loader cannot resolve later: +# BUILD_LDFLAGS has no --as-needed, there is no libatomic-native, and uninative +# only rewrites the interpreter. Hosts without a system libatomic then fail with +# "clippy: error while loading shared libraries: libatomic.so.1". +LDFLAGS:append:class-native = " -Wl,--as-needed" + SYSTEMD_PACKAGES = "${PN}" SYSTEMD_SERVICE:${PN} = "frr.service" SYSTEMD_AUTO_ENABLE = "disable"