From 9f60aa973d1fb3905eb3f655b32ec368419e2bf6 Mon Sep 17 00:00:00 2001 From: Brandon Lumbra Date: Thu, 13 Mar 2025 13:35:56 -0400 Subject: [PATCH] package/rt-tests: fix build with glibc 2.41+ Since glibc bump to 2.41 in Buildroot commit [1], rt-tests is failing to build with error: In file included from src/lib/rt-utils.c:28: src/include/rt-sched.h:45:8: error: redefinition of 'struct sched_attr' 45 | struct sched_attr { | ^~~~~~~~~~ glibc 2.41 adds sched_*attr, conflicting with rt-sched.h in the rt-tests package. This commit resolves the conflict by applying a patch from upstream which excludes the conflicting code when using glibc >= 2.41. Fixes: https://autobuild.buildroot.org/results/30308c74291004c328d6c3603ce68d600c5ef281/ [1] https://gitlab.com/buildroot.org/buildroot/-/commit/6ecab31fad12a494ec0d2a3767c736a55c80a769 Signed-off-by: Brandon Lumbra [Julien: - add extra info in commit log - add missing Signed-off-by line in commit log - add missing Signed-off-by in patch ] Signed-off-by: Julien Olivain --- .../0003-Fix-build-with-glibc-2.41.patch | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 package/rt-tests/0003-Fix-build-with-glibc-2.41.patch diff --git a/package/rt-tests/0003-Fix-build-with-glibc-2.41.patch b/package/rt-tests/0003-Fix-build-with-glibc-2.41.patch new file mode 100644 index 0000000000..6899b55c99 --- /dev/null +++ b/package/rt-tests/0003-Fix-build-with-glibc-2.41.patch @@ -0,0 +1,57 @@ +From 280e198c39d1b17d0491d7c4e7afda97ae6c8e6f Mon Sep 17 00:00:00 2001 +From: Yaakov Selkowitz +Date: Wed, 29 Jan 2025 16:46:11 -0500 +Subject: [PATCH] Fix rt-tests build with glibc-2.41 + +The sched_*attr APIs were added to glibc +https://sourceware.org/git/?p=glibc.git;a=commit;h=21571ca0d70302909cf72707b2a7736cf12190a0 + +This fixes the build conflict in rt-tests with glibc-2.4 + +Signed-off-by: Yaakov Selkowitz +Signed-off-by: John Kacur +Upstream: https://web.git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/commit/?id=d3a23a0cc76789c3083df3bad78982cd49bc4c5e +Signed-off-by: Brandon Lumbra +--- + src/include/rt-sched.h | 2 ++ + src/lib/rt-sched.c | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/src/include/rt-sched.h b/src/include/rt-sched.h +index 80171c76e0ee..dfd7f45f51cc 100644 +--- a/src/include/rt-sched.h ++++ b/src/include/rt-sched.h +@@ -42,6 +42,7 @@ + #define __NR_sched_getattr 275 + #endif + ++#if ! __GLIBC_PREREQ(2, 41) + struct sched_attr { + uint32_t size; + uint32_t sched_policy; +@@ -67,5 +68,6 @@ int sched_getattr(pid_t pid, + struct sched_attr *attr, + unsigned int size, + unsigned int flags); ++#endif + + #endif /* __RT_SCHED_H__ */ +diff --git a/src/lib/rt-sched.c b/src/lib/rt-sched.c +index 8023bc70c473..2500abde26e4 100644 +--- a/src/lib/rt-sched.c ++++ b/src/lib/rt-sched.c +@@ -14,6 +14,7 @@ + + #include "rt-sched.h" + ++#if ! __GLIBC_PREREQ(2, 41) + int sched_setattr(pid_t pid, + const struct sched_attr *attr, + unsigned int flags) +@@ -28,3 +29,4 @@ int sched_getattr(pid_t pid, + { + return syscall(__NR_sched_getattr, pid, attr, size, flags); + } ++#endif +-- +2.47.1