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

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