Skip to contentSkip to conversation

dlt-daemon: Fix build with clang-23

PATCH New Khem Raj 1 participant 2 messages Sep 10

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 dlt-daemon: Fix build with clang-23

clang 23 added -Wunused-but-set-global, enabled by -Wall, and the build uses -Werror -Wfatal-errors, so this is now a hard failure:

  src/lib/dlt_user.c:132:20: fatal error: variable
    'dlt_user_housekeeper_exit_requested' set but not used
    [-Wunused-but-set-global]
    132 | static atomic_bool dlt_user_housekeeper_exit_requested = false;

The diagnostic is pointing at a real bug: dlt_user_atexit_handler() sets the flag to "Signal housekeeper thread to exit", but nothing ever reads it, so the housekeeper thread only ever stops when dlt_stop_threads() cancels it. Not fixed upstream, master still has the same dead store.

Add a patch checking the flag in the housekeeper loop condition. Leaving the loop that way is equivalent to being cancelled, pthread_cleanup_pop(1) at the end of the function runs dlt_user_cleanup_handler() either way.

---
 ...t_user_housekeeper_exit_requested-in.patch | 43 +++++++++++++++++++
 .../dlt-daemon/dlt-daemon_3.0.0.bb            |  1 +
 2 files changed, 44 insertions(+)
 create mode 100644 meta-oe/recipes-extended/dlt-daemon/dlt-daemon/0001-dlt_user-Honor-dlt_user_housekeeper_exit_requested-in.patch
meta-oe/recipes-extended/dlt-daemon/dlt-daemon/0001-dlt_user-Honor-dlt_user_housekeeper_exit_requested-in.patch new file +43 -0
new file mode 100644
index 0000000000..a3adbd9d76
@@ -0,0 +1,43 @@
+From 9ddee0a5f46a1d7fea81228e6905ebc485e678a7 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Wed, 9 Sep 2026 20:24:55 -0700
+Subject: [PATCH] dlt_user: Honor dlt_user_housekeeper_exit_requested in
+ housekeeper loop
+
+dlt_user_atexit_handler() sets dlt_user_housekeeper_exit_requested to
+signal the housekeeper thread to exit, but nothing ever reads the flag,
+so the housekeeper thread keeps running until dlt_stop_threads() cancels
+it with pthread_cancel().
+
+clang 23 added -Wunused-but-set-global (enabled by -Wall) which spots
+this dead store, and since the build uses -Werror -Wfatal-errors it is
+now a hard build failure:
+
+  src/lib/dlt_user.c:132:20: fatal error: variable
+    'dlt_user_housekeeper_exit_requested' set but not used
+    [-Wunused-but-set-global]
+    132 | static atomic_bool dlt_user_housekeeper_exit_requested = false;
+
+Check the flag in the housekeeper loop condition, which is what the
+"Signal housekeeper thread to exit" comment intends. Leaving the loop
+this way is equivalent to being cancelled: pthread_cleanup_pop(1) at the
+end of the function runs dlt_user_cleanup_handler() either way.
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/lib/dlt_user.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c
+index daf5e8b..9fa2906 100644
+--- a/src/lib/dlt_user.c
++++ b/src/lib/dlt_user.c
+@@ -4850,7 +4850,7 @@ void *dlt_user_housekeeperthread_function(void *ptr)
+
+     pthread_mutex_unlock(&dlt_housekeeper_running_mutex);
+
+-    while (in_loop) {
++    while (in_loop && !dlt_user_housekeeper_exit_requested) {
+         /* Check for new messages from DLT daemon */
+         if (!dlt_user.disable_injection_msg)
+             if (dlt_user_log_check_user_message() < DLT_RETURN_OK)
meta-oe/recipes-extended/dlt-daemon/dlt-daemon_3.0.0.bb +1 -0
index 6de62c2a3d..79f28c2901 100644
@@ -26,6 +26,7 @@ SRC_URI = "git://github.com/COVESA/${BPN}.git;protocol=https;branch=master \
            file://0001-warnings-Fix-clang-generated-warnings.patch \
            file://0001-dlt-daemon.c-fix-wrong-len.patch \
            file://char_conversion.patch \
+           file://0001-dlt_user-Honor-dlt_user_housekeeper_exit_requested-in.patch \
            "
 SRCREV = "f595ea29d1007ca1c3b2d1fd3a88adf7d3db6320"
 
author
#1 lore raw

PATCH 2/2 ot-br-posix: Update to latest tip on trunk

Fixes build with clang-23, which enables -Wunused-template in a way that trips over openthread's parse_cmdline.hpp. With -Werror -Wfatal-errors that is fatal:

third_party/openthread/repo/src/core/utils/parse_cmdline.hpp:240:48:
fatal error: unused function template 'ParseAsHexString' [-Wunused-template]

Already fixed upstream in openthread commit 30c3569ac5ca ("[parse-cmdline] make ParseAsHexString() inline"), which the openthread submodule of the new SRCREV includes, so bump instead of carrying a backport.

Adapt the recipe to upstream changes made since the previous SRCREV:

* ot-br-posix commit cf4877d68af8 ("[mdns] remove avahi publisher option and dependencies") deleted the avahi mDNS publisher; OTBR_MDNS=avahi is now a configure-time FATAL_ERROR. Switch to OTBR_MDNS=openthread, the new upstream default, and drop the avahi/avahi-daemon dependencies the same way upstream did in their own etc/yocto/otbr_git.bb.

* The advertising and discovery proxies grew OT core implementations (OTBR_OT_SRP_ADV_PROXY, OTBR_OT_DISCOVERY_PROXY) which default to ON whenever OTBR_MDNS is set, and enabling both variants is now a FATAL_ERROR ("Only one Advertising Proxy can be enabled."). Drop the explicit OTBR_SRP_ADVERTISING_PROXY/OTBR_DNSSD_DISCOVERY_PROXY=ON so the OT core ones are used.

* Drop 0001-otbr-agent.service.in-remove-pre-exec-hook-for-mdns-.patch. With OTBR_MDNS=openthread src/agent/CMakeLists.txt never sets EXEC_START_PRE, so the generated otbr-agent.service already has a bare ExecStart= and the patch has nothing left to do.

---
 ...ce.in-remove-pre-exec-hook-for-mdns-.patch | 35 -------------------
 .../openthread/ot-br-posix_git.bb             | 11 +++---
 2 files changed, 4 insertions(+), 42 deletions(-)
 delete mode 100644 meta-networking/recipes-connectivity/openthread/ot-br-posix/0001-otbr-agent.service.in-remove-pre-exec-hook-for-mdns-.patch
meta-networking/recipes-connectivity/openthread/ot-br-posix/0001-otbr-agent.service.in-remove-pre-exec-hook-for-mdns-.patch deleted +0 -35
deleted file mode 100644
index 250de4bdd8..0000000000
@@ -1,35 +0,0 @@
-From ed60d4605b81c43b9ba9504a37835109c247c6f8 Mon Sep 17 00:00:00 2001
-From: Stefan Schmidt <[email protected]>
-Date: Fri, 1 Apr 2022 21:46:03 +0200
-Subject: [PATCH] otbr-agent.service.in: remove pre exec hook for mdns service
-
-It uses the service command which is not available in all cases under
-Yocto/OE. The upstream project uses this mainly with Ubuntu and Raspian
-as testbeds.
-
-In our case we simply ensure that avahi-daemon is installed on the
-system inside the recipe.
-
-Upstream-Status: Inappropriate [OE specific]
-
-Signed-off-by: Stefan Schmidt <[email protected]>
----
- src/agent/otbr-agent.service.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/agent/otbr-agent.service.in b/src/agent/otbr-agent.service.in
-index 8314121347..4c97869def 100644
---- a/src/agent/otbr-agent.service.in
-+++ b/src/agent/otbr-agent.service.in
-@@ -6,7 +6,7 @@ After=dbus.socket
-
- [Service]
- EnvironmentFile=-@CMAKE_INSTALL_FULL_SYSCONFDIR@/default/otbr-agent
--@EXEC_START_PRE@ExecStart=@CMAKE_INSTALL_FULL_SBINDIR@/otbr-agent $OTBR_AGENT_OPTS
-+ExecStart=@CMAKE_INSTALL_FULL_SBINDIR@/otbr-agent $OTBR_AGENT_OPTS
- KillMode=mixed
- Restart=on-failure
- RestartSec=5
---
-2.35.1
-
meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb +4 -7
index d1938e12a1..8c49a30327 100644
@@ -9,12 +9,11 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=87109e44b2fda96a8991f27684a7349c \
                     file://third_party/cpp-httplib/repo/LICENSE;md5=1321bdf796c67e3a8ab8e352dd81474b \
                     file://third_party/openthread/repo/LICENSE;md5=543b6fe90ec5901a683320a36390c65f \
                     "
-DEPENDS = "autoconf-archive dbus readline avahi jsoncpp boost libnetfilter-queue protobuf protobuf-native"
-SRCREV = "0700948634b85947e893a65e3d510ed870a5755b"
+DEPENDS = "autoconf-archive dbus readline jsoncpp boost libnetfilter-queue protobuf protobuf-native"
+SRCREV = "cb0bfde934ad7519610a63b75c067f8d7601fe21"
 PV = "0.3.0+git"
 
 SRC_URI = "gitsm://github.com/openthread/ot-br-posix.git;protocol=https;branch=main \
-           file://0001-otbr-agent.service.in-remove-pre-exec-hook-for-mdns-.patch \
            file://0001-cmake-Disable-nonnull-compare-warning-on-gcc.patch \
            file://default-cxx-std.patch \
            file://0001-x509_crt-Zero-initialize-mbedtls_x509_time-at-declar.patch;patchdir=third_party/openthread/repo \
@@ -36,10 +35,9 @@ EXTRA_OECMAKE = "-DBUILD_TESTING=OFF \
                  -DCMAKE_LIBRARY_PATH=${libdir} \
                  -DOT_POSIX_PRODUCT_CONFIG=${sysconfdir}/openthread.conf.example \
                  -DOT_POSIX_FACTORY_CONFIG=${sysconfdir}/openthread.conf.example \
-                 -DOTBR_MDNS=avahi \
+                 -DOTBR_MDNS=openthread \
                  -DOTBR_BACKBONE_ROUTER=ON \
                  -DOTBR_BORDER_ROUTING=ON \
-                 -DOTBR_SRP_ADVERTISING_PROXY=ON \
                  -DOTBR_BORDER_AGENT=ON \
                  -DOT_SPINEL_RESET_CONNECTION=ON \
                  -DOT_TREL=ON \
@@ -50,7 +48,6 @@ EXTRA_OECMAKE = "-DBUILD_TESTING=OFF \
                  -DOTBR_DUA_ROUTING=ON \
                  -DOT_DUA=ON \
                  -DOT_BORDER_ROUTING_NAT64=ON \
-                 -DOTBR_DNSSD_DISCOVERY_PROXY=ON \
                  -DOTBR_INFRA_IF_NAME=eth0 \
                  -DOTBR_NO_AUTO_ATTACH=1 \
                  -DOT_REFERENCE_DEVICE=ON \
@@ -59,7 +56,7 @@ EXTRA_OECMAKE = "-DBUILD_TESTING=OFF \
                  -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
                  "
 
-RDEPENDS:${PN} = "iproute2 ipset avahi-daemon"
+RDEPENDS:${PN} = "iproute2 ipset"
 
 RCONFLICTS:${PN} = "ot-daemon"