package/qemu: fix build on hosts with newer glibc
PATCH 1/1 package/qemu: fix build on hosts with newer glibc
Add a patch fixing builds on newer glibc versions.
Fixes:../linux-user/syscall.c:362:8: error: redefinition of ‘struct sched_attr’
362 | struct sched_attr {
| ^~~~~~~~~~
In file included from /usr/include/bits/sched.h:63,
from /usr/include/sched.h:43,
from /usr/include/pthread.h:22,
from /home/buildroot/buildroot/output/per-package/host-qemu/host/include/glib-2.0/glib/deprecated/gthread.h:126,
from /home/buildroot/buildroot/output/per-package/host-qemu/host/include/glib-2.0/glib.h:115,
from /home/buildroot/buildroot/output/build/host-qemu-9.2.0/include/glib-compat.h:32,
from /home/buildroot/buildroot/output/build/host-qemu-9.2.0/include/qemu/osdep.h:161,
from ../linux-user/syscall.c:20:
/usr/include/linux/sched/types.h:98:8: note: originally defined here
98 | struct sched_attr {
| ^~~~~~~~~~--- ...ed_attr-Do-not-define-for-glibc-2.41.patch | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 package/qemu/0003-sched_attr-Do-not-define-for-glibc-2.41.patch
package/qemu/0003-sched_attr-Do-not-define-for-glibc-2.41.patch new file +49 -0
@@ -0,0 +1,49 @@ +From 66b1926d72ef51d4d59d0f97061f26a75651e265 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Fri, 11 Oct 2024 12:31:40 -0700 +Subject: [PATCH] sched_attr: Do not define for glibc >= 2.41 + +glibc 2.41+ has added [1] definitions for sched_setattr and sched_getattr functions +and struct sched_attr. Therefore, it needs to be checked for here as well before +defining sched_attr + +Define sched_attr conditionally on SCHED_ATTR_SIZE_VER0 + +Fixes builds with glibc/trunk + +[1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=21571ca0d70302909cf72707b2a7736cf12190a0;hp=298bc488fdc047da37482f4003023cb9adef78f8 + +Signed-off-by: Khem Raj <[email protected]> +Cc: Laurent Vivier <[email protected]> +Cc: Paolo Bonzini <[email protected]> +Signed-off-by: James Hilliard <[email protected]> +Upstream: https://patchwork.kernel.org/project/qemu-devel/patch/[email protected]/ +--- + linux-user/syscall.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index 1ce4c79784..a407d4a023 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -358,7 +358,8 @@ _syscall3(int, sys_sched_getaffinity, pid_t, pid, unsigned int, len, + #define __NR_sys_sched_setaffinity __NR_sched_setaffinity + _syscall3(int, sys_sched_setaffinity, pid_t, pid, unsigned int, len, + unsigned long *, user_mask_ptr); +-/* sched_attr is not defined in glibc */ ++/* sched_attr is not defined in glibc < 2.41 */ ++#ifndef SCHED_ATTR_SIZE_VER0 + struct sched_attr { + uint32_t size; + uint32_t sched_policy; +@@ -371,6 +372,7 @@ struct sched_attr { + uint32_t sched_util_min; + uint32_t sched_util_max; + }; ++#endif + #define __NR_sys_sched_getattr __NR_sched_getattr + _syscall4(int, sys_sched_getattr, pid_t, pid, struct sched_attr *, attr, + unsigned int, size, unsigned int, flags); +-- +2.34.1 +
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Julien Olivain
AppliedQuoted 17 lines · James Hilliard
Add a patch fixing builds on newer glibc versions.
Fixes:
../linux-user/syscall.c:362:8: error: redefinition of ‘struct sched_attr’362 | struct sched_attr { | ^~~~~~~~~~ In file included from /usr/include/bits/sched.h:63, from /usr/include/sched.h:43, from /usr/include/pthread.h:22, from
/home/buildroot/buildroot/output/per-package/host-qemu/host/include/glib-2.0/glib/deprecated/gthread.h:126,
from/home/buildroot/buildroot/output/per-package/host-qemu/host/include/glib-2.0/glib.h:115,
from/home/buildroot/buildroot/output/build/host-qemu-9.2.0/include/glib-compat.h:32,
from/home/buildroot/buildroot/output/build/host-qemu-9.2.0/include/qemu/osdep.h:161,
Quoted 6 lines
from ../linux-user/syscall.c:20: /usr/include/linux/sched/types.h:98:8: note: originally defined here 98 | struct sched_attr { | ^~~~~~~~~~Signed-off-by James Hilliard <[email protected]>
Applied to master, thanks.
I slightly reworded the commit log to add more information and links.
Best regards,
Julien.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot