Blame SOURCES/kvm-meson.build-Fix-docker-test-build-alpine-when-includ.patch

29b115
From 7c489b54b0bb33445113fbf16e88feb23be68013 Mon Sep 17 00:00:00 2001
29b115
From: Leonardo Bras <leobras@redhat.com>
29b115
Date: Fri, 13 May 2022 03:28:30 -0300
29b115
Subject: [PATCH 07/18] meson.build: Fix docker-test-build@alpine when
29b115
 including linux/errqueue.h
29b115
MIME-Version: 1.0
29b115
Content-Type: text/plain; charset=UTF-8
29b115
Content-Transfer-Encoding: 8bit
29b115
29b115
RH-Author: Leonardo BrĂ¡s <leobras@redhat.com>
29b115
RH-MergeRequest: 95: MSG_ZEROCOPY + Multifd
29b115
RH-Commit: [1/11] f058eb846fcf611d527a1dd3b0cc399cdc17e3ee (LeoBras/centos-qemu-kvm)
29b115
RH-Bugzilla: 1968509
29b115
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
29b115
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
29b115
RH-Acked-by: Peter Xu <peterx@redhat.com>
29b115
29b115
A build error happens in alpine CI when linux/errqueue.h is included
29b115
in io/channel-socket.c, due to redefining of 'struct __kernel_timespec':
29b115
29b115
===
29b115
ninja: job failed: [...]
29b115
In file included from /usr/include/linux/errqueue.h:6,
29b115
                 from ../io/channel-socket.c:29:
29b115
/usr/include/linux/time_types.h:7:8: error: redefinition of 'struct __kernel_timespec'
29b115
    7 | struct __kernel_timespec {
29b115
      |        ^~~~~~~~~~~~~~~~~
29b115
In file included from /usr/include/liburing.h:19,
29b115
                 from /builds/user/qemu/include/block/aio.h:18,
29b115
                 from /builds/user/qemu/include/io/channel.h:26,
29b115
                 from /builds/user/qemu/include/io/channel-socket.h:24,
29b115
                 from ../io/channel-socket.c:24:
29b115
/usr/include/liburing/compat.h:9:8: note: originally defined here
29b115
    9 | struct __kernel_timespec {
29b115
      |        ^~~~~~~~~~~~~~~~~
29b115
ninja: subcommand failed
29b115
===
29b115
29b115
As above error message suggests, 'struct __kernel_timespec' was already
29b115
defined by liburing/compat.h.
29b115
29b115
Fix alpine CI by adding test to disable liburing in configure step if a
29b115
redefinition happens between linux/errqueue.h and liburing/compat.h.
29b115
29b115
[dgilbert: This has been fixed in Alpine issue 13813 and liburing]
29b115
29b115
Signed-off-by: Leonardo Bras <leobras@redhat.com>
29b115
Message-Id: <20220513062836.965425-2-leobras@redhat.com>
29b115
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
29b115
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
29b115
(cherry picked from commit 354081d43de44ebd3497fe08f7f0121a5517d528)
29b115
Signed-off-by: Leonardo Bras <leobras@redhat.com>
29b115
---
29b115
 meson.build | 11 +++++++++++
29b115
 1 file changed, 11 insertions(+)
29b115
29b115
diff --git a/meson.build b/meson.build
29b115
index 5a7c10e639..13e3323380 100644
29b115
--- a/meson.build
29b115
+++ b/meson.build
29b115
@@ -471,12 +471,23 @@ if not get_option('linux_aio').auto() or have_block
29b115
                            required: get_option('linux_aio'),
29b115
                            kwargs: static_kwargs)
29b115
 endif
29b115
+
29b115
+linux_io_uring_test = '''
29b115
+  #include <liburing.h>
29b115
+  #include <linux/errqueue.h>
29b115
+
29b115
+  int main(void) { return 0; }'''
29b115
+
29b115
 linux_io_uring = not_found
29b115
 if not get_option('linux_io_uring').auto() or have_block
29b115
   linux_io_uring = dependency('liburing', version: '>=0.3',
29b115
                               required: get_option('linux_io_uring'),
29b115
                               method: 'pkg-config', kwargs: static_kwargs)
29b115
+  if not cc.links(linux_io_uring_test)
29b115
+    linux_io_uring = not_found
29b115
+  endif
29b115
 endif
29b115
+
29b115
 libnfs = not_found
29b115
 if not get_option('libnfs').auto() or have_block
29b115
   libnfs = dependency('libnfs', version: '>=1.9.3',
29b115
-- 
29b115
2.35.3
29b115