Files
rpi-buildroot/package/util-linux/0002-c.h-consolidate-THREAD_LOCAL.patch
Julien Olivain 8489cb0932 package/util-linux: fix libuuid build without pthread
Since Buildroot commit [1], util-linux libuuid is failing to build
with uclibc toolchains, when there is no thread support
(that is, when BR2_PTHREADS_NONE=y).

Builds are failing with error:

    libuuid/src/gen_uuid.c:83:10: fatal error: pthread.h: No such file or directory
       83 | #include <pthread.h>
          |          ^~~~~~~~~~~

This failure is due to the upstream commit [2], which introduced the
pthread dependency.

This commit fixes the issue by adding package patches, disabling
the uuidd cache in case the libptread (or the pthread_atfork function)
is not available.

Fixes:
https://autobuild.buildroot.org/results/e5856cf6f3b8512ededa17d20db2b330a478dd8e/

[1] f14929c657
[2] 25bd5396ab

Signed-off-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2025-02-04 14:14:39 +01:00

66 lines
1.6 KiB
Diff

From 7b3db914fa9073c667ea482c8b6b4e07fe6202cc Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 27 Jan 2025 13:40:23 +0100
Subject: [PATCH] c.h: consolidate THREAD_LOCAL.
Let's define this macro in one place only.
Upstream: https://github.com/util-linux/util-linux/pull/3383
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
---
include/c.h | 9 +++++++++
lib/randutils.c | 5 -----
libuuid/src/gen_uuid.c | 1 -
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/include/c.h b/include/c.h
index 61b95ab2d..848c48536 100644
--- a/include/c.h
+++ b/include/c.h
@@ -595,4 +595,13 @@ static inline void *reallocarray(void *ptr, size_t nmemb, size_t size)
}
#endif
+/*
+ * thread-local storage
+ */
+#ifdef HAVE_TLS
+# define THREAD_LOCAL static __thread
+#else
+# define THREAD_LOCAL static
+#endif
+
#endif /* UTIL_LINUX_C_H */
diff --git a/lib/randutils.c b/lib/randutils.c
index 15c2f7834..4c806e682 100644
--- a/lib/randutils.c
+++ b/lib/randutils.c
@@ -20,11 +20,6 @@
#include "randutils.h"
#include "nls.h"
-#ifdef HAVE_TLS
-#define THREAD_LOCAL static __thread
-#else
-#define THREAD_LOCAL static
-#endif
#ifdef HAVE_GETRANDOM
# include <sys/random.h>
diff --git a/libuuid/src/gen_uuid.c b/libuuid/src/gen_uuid.c
index 3b76ddc9a..69712267f 100644
--- a/libuuid/src/gen_uuid.c
+++ b/libuuid/src/gen_uuid.c
@@ -92,7 +92,6 @@
#include "md5.h"
#include "sha1.h"
-#define THREAD_LOCAL static __thread
#ifdef _WIN32
static void gettimeofday (struct timeval *tv, void *dummy)
--
2.48.1