diff mbox series

[v13,1/8] meson.build: Fix docker-test-build@alpine when including linux/errqueue.h

Message ID 20220513062836.965425-2-leobras@redhat.com (mailing list archive)
State New, archived
Headers show
Series MSG_ZEROCOPY + multifd | expand

Commit Message

Leonardo Bras May 13, 2022, 6:28 a.m. UTC
A build error happens in alpine CI when linux/errqueue.h is included
in io/channel-socket.c, due to redefining of 'struct __kernel_timespec':

===
ninja: job failed: [...]
In file included from /usr/include/linux/errqueue.h:6,
                 from ../io/channel-socket.c:29:
/usr/include/linux/time_types.h:7:8: error: redefinition of 'struct __kernel_timespec'
    7 | struct __kernel_timespec {
      |        ^~~~~~~~~~~~~~~~~
In file included from /usr/include/liburing.h:19,
                 from /builds/user/qemu/include/block/aio.h:18,
                 from /builds/user/qemu/include/io/channel.h:26,
                 from /builds/user/qemu/include/io/channel-socket.h:24,
                 from ../io/channel-socket.c:24:
/usr/include/liburing/compat.h:9:8: note: originally defined here
    9 | struct __kernel_timespec {
      |        ^~~~~~~~~~~~~~~~~
ninja: subcommand failed
===

As above error message suggests, 'struct __kernel_timespec' was already
defined by liburing/compat.h.

Fix alpine CI by adding test to disable liburing in configure step if a
redefinition happens between linux/errqueue.h and liburing/compat.h.

Signed-off-by: Leonardo Bras <leobras@redhat.com>
---
 meson.build | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Dr. David Alan Gilbert May 16, 2022, 11:13 a.m. UTC | #1
* Leonardo Bras (leobras@redhat.com) wrote:
> A build error happens in alpine CI when linux/errqueue.h is included
> in io/channel-socket.c, due to redefining of 'struct __kernel_timespec':

OK, looks to be same mechanism as other meson tests.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ===
> ninja: job failed: [...]
> In file included from /usr/include/linux/errqueue.h:6,
>                  from ../io/channel-socket.c:29:
> /usr/include/linux/time_types.h:7:8: error: redefinition of 'struct __kernel_timespec'
>     7 | struct __kernel_timespec {
>       |        ^~~~~~~~~~~~~~~~~
> In file included from /usr/include/liburing.h:19,
>                  from /builds/user/qemu/include/block/aio.h:18,
>                  from /builds/user/qemu/include/io/channel.h:26,
>                  from /builds/user/qemu/include/io/channel-socket.h:24,
>                  from ../io/channel-socket.c:24:
> /usr/include/liburing/compat.h:9:8: note: originally defined here
>     9 | struct __kernel_timespec {
>       |        ^~~~~~~~~~~~~~~~~
> ninja: subcommand failed
> ===
> 
> As above error message suggests, 'struct __kernel_timespec' was already
> defined by liburing/compat.h.
> 
> Fix alpine CI by adding test to disable liburing in configure step if a
> redefinition happens between linux/errqueue.h and liburing/compat.h.
> 
> Signed-off-by: Leonardo Bras <leobras@redhat.com>
> ---
>  meson.build | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index 9b20dcd143..a996690c9b 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -515,12 +515,23 @@ if not get_option('linux_aio').auto() or have_block
>                             required: get_option('linux_aio'),
>                             kwargs: static_kwargs)
>  endif
> +
> +linux_io_uring_test = '''
> +  #include <liburing.h>
> +  #include <linux/errqueue.h>
> +
> +  int main(void) { return 0; }'''
> +
>  linux_io_uring = not_found
>  if not get_option('linux_io_uring').auto() or have_block
>    linux_io_uring = dependency('liburing', version: '>=0.3',
>                                required: get_option('linux_io_uring'),
>                                method: 'pkg-config', kwargs: static_kwargs)
> +  if not cc.links(linux_io_uring_test)
> +    linux_io_uring = not_found
> +  endif
>  endif
> +
>  libnfs = not_found
>  if not get_option('libnfs').auto() or have_block
>    libnfs = dependency('libnfs', version: '>=1.9.3',
> -- 
> 2.36.1
> 
>
Daniel P. Berrangé May 16, 2022, 11:17 a.m. UTC | #2
On Mon, May 16, 2022 at 12:13:16PM +0100, Dr. David Alan Gilbert wrote:
> * Leonardo Bras (leobras@redhat.com) wrote:
> > A build error happens in alpine CI when linux/errqueue.h is included
> > in io/channel-socket.c, due to redefining of 'struct __kernel_timespec':
> 
> OK, looks to be same mechanism as other meson tests.

> 
> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

As of about an hour or so ago, this patch should not be required.

  https://gitlab.alpinelinux.org/alpine/aports/-/issues/13813

> 
> > ===
> > ninja: job failed: [...]
> > In file included from /usr/include/linux/errqueue.h:6,
> >                  from ../io/channel-socket.c:29:
> > /usr/include/linux/time_types.h:7:8: error: redefinition of 'struct __kernel_timespec'
> >     7 | struct __kernel_timespec {
> >       |        ^~~~~~~~~~~~~~~~~
> > In file included from /usr/include/liburing.h:19,
> >                  from /builds/user/qemu/include/block/aio.h:18,
> >                  from /builds/user/qemu/include/io/channel.h:26,
> >                  from /builds/user/qemu/include/io/channel-socket.h:24,
> >                  from ../io/channel-socket.c:24:
> > /usr/include/liburing/compat.h:9:8: note: originally defined here
> >     9 | struct __kernel_timespec {
> >       |        ^~~~~~~~~~~~~~~~~
> > ninja: subcommand failed
> > ===
> > 
> > As above error message suggests, 'struct __kernel_timespec' was already
> > defined by liburing/compat.h.
> > 
> > Fix alpine CI by adding test to disable liburing in configure step if a
> > redefinition happens between linux/errqueue.h and liburing/compat.h.
> > 
> > Signed-off-by: Leonardo Bras <leobras@redhat.com>
> > ---
> >  meson.build | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/meson.build b/meson.build
> > index 9b20dcd143..a996690c9b 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -515,12 +515,23 @@ if not get_option('linux_aio').auto() or have_block
> >                             required: get_option('linux_aio'),
> >                             kwargs: static_kwargs)
> >  endif
> > +
> > +linux_io_uring_test = '''
> > +  #include <liburing.h>
> > +  #include <linux/errqueue.h>
> > +
> > +  int main(void) { return 0; }'''
> > +
> >  linux_io_uring = not_found
> >  if not get_option('linux_io_uring').auto() or have_block
> >    linux_io_uring = dependency('liburing', version: '>=0.3',
> >                                required: get_option('linux_io_uring'),
> >                                method: 'pkg-config', kwargs: static_kwargs)
> > +  if not cc.links(linux_io_uring_test)
> > +    linux_io_uring = not_found
> > +  endif
> >  endif
> > +
> >  libnfs = not_found
> >  if not get_option('libnfs').auto() or have_block
> >    libnfs = dependency('libnfs', version: '>=1.9.3',
> > -- 
> > 2.36.1
> > 
> > 
> -- 
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
> 

With regards,
Daniel
Dr. David Alan Gilbert May 16, 2022, 11:30 a.m. UTC | #3
* Daniel P. Berrangé (berrange@redhat.com) wrote:
> On Mon, May 16, 2022 at 12:13:16PM +0100, Dr. David Alan Gilbert wrote:
> > * Leonardo Bras (leobras@redhat.com) wrote:
> > > A build error happens in alpine CI when linux/errqueue.h is included
> > > in io/channel-socket.c, due to redefining of 'struct __kernel_timespec':
> > 
> > OK, looks to be same mechanism as other meson tests.
> 
> > 
> > Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> 
> As of about an hour or so ago, this patch should not be required.
> 
>   https://gitlab.alpinelinux.org/alpine/aports/-/issues/13813

I'll take it anyway as protection against any other broken build envs.

Dave

> > 
> > > ===
> > > ninja: job failed: [...]
> > > In file included from /usr/include/linux/errqueue.h:6,
> > >                  from ../io/channel-socket.c:29:
> > > /usr/include/linux/time_types.h:7:8: error: redefinition of 'struct __kernel_timespec'
> > >     7 | struct __kernel_timespec {
> > >       |        ^~~~~~~~~~~~~~~~~
> > > In file included from /usr/include/liburing.h:19,
> > >                  from /builds/user/qemu/include/block/aio.h:18,
> > >                  from /builds/user/qemu/include/io/channel.h:26,
> > >                  from /builds/user/qemu/include/io/channel-socket.h:24,
> > >                  from ../io/channel-socket.c:24:
> > > /usr/include/liburing/compat.h:9:8: note: originally defined here
> > >     9 | struct __kernel_timespec {
> > >       |        ^~~~~~~~~~~~~~~~~
> > > ninja: subcommand failed
> > > ===
> > > 
> > > As above error message suggests, 'struct __kernel_timespec' was already
> > > defined by liburing/compat.h.
> > > 
> > > Fix alpine CI by adding test to disable liburing in configure step if a
> > > redefinition happens between linux/errqueue.h and liburing/compat.h.
> > > 
> > > Signed-off-by: Leonardo Bras <leobras@redhat.com>
> > > ---
> > >  meson.build | 11 +++++++++++
> > >  1 file changed, 11 insertions(+)
> > > 
> > > diff --git a/meson.build b/meson.build
> > > index 9b20dcd143..a996690c9b 100644
> > > --- a/meson.build
> > > +++ b/meson.build
> > > @@ -515,12 +515,23 @@ if not get_option('linux_aio').auto() or have_block
> > >                             required: get_option('linux_aio'),
> > >                             kwargs: static_kwargs)
> > >  endif
> > > +
> > > +linux_io_uring_test = '''
> > > +  #include <liburing.h>
> > > +  #include <linux/errqueue.h>
> > > +
> > > +  int main(void) { return 0; }'''
> > > +
> > >  linux_io_uring = not_found
> > >  if not get_option('linux_io_uring').auto() or have_block
> > >    linux_io_uring = dependency('liburing', version: '>=0.3',
> > >                                required: get_option('linux_io_uring'),
> > >                                method: 'pkg-config', kwargs: static_kwargs)
> > > +  if not cc.links(linux_io_uring_test)
> > > +    linux_io_uring = not_found
> > > +  endif
> > >  endif
> > > +
> > >  libnfs = not_found
> > >  if not get_option('libnfs').auto() or have_block
> > >    libnfs = dependency('libnfs', version: '>=1.9.3',
> > > -- 
> > > 2.36.1
> > > 
> > > 
> > -- 
> > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
> > 
> 
> With regards,
> Daniel
> -- 
> |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
>
Daniel P. Berrangé May 16, 2022, 11:35 a.m. UTC | #4
On Mon, May 16, 2022 at 12:30:15PM +0100, Dr. David Alan Gilbert wrote:
> * Daniel P. Berrangé (berrange@redhat.com) wrote:
> > On Mon, May 16, 2022 at 12:13:16PM +0100, Dr. David Alan Gilbert wrote:
> > > * Leonardo Bras (leobras@redhat.com) wrote:
> > > > A build error happens in alpine CI when linux/errqueue.h is included
> > > > in io/channel-socket.c, due to redefining of 'struct __kernel_timespec':
> > > 
> > > OK, looks to be same mechanism as other meson tests.
> > 
> > > 
> > > Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > 
> > As of about an hour or so ago, this patch should not be required.
> > 
> >   https://gitlab.alpinelinux.org/alpine/aports/-/issues/13813
> 
> I'll take it anyway as protection against any other broken build envs.

Can you update the commit message at least then.

The root casue trigger for the bug is the OS uses a busybox
impl of mkdtemp, which isn't compat with the args liburing
configure was previously using. I doubt there are many such OS
around to be honest, as most will use coreutils.

With regards,
Daniel
Dr. David Alan Gilbert May 16, 2022, 12:51 p.m. UTC | #5
* Daniel P. Berrangé (berrange@redhat.com) wrote:
> On Mon, May 16, 2022 at 12:30:15PM +0100, Dr. David Alan Gilbert wrote:
> > * Daniel P. Berrangé (berrange@redhat.com) wrote:
> > > On Mon, May 16, 2022 at 12:13:16PM +0100, Dr. David Alan Gilbert wrote:
> > > > * Leonardo Bras (leobras@redhat.com) wrote:
> > > > > A build error happens in alpine CI when linux/errqueue.h is included
> > > > > in io/channel-socket.c, due to redefining of 'struct __kernel_timespec':
> > > > 
> > > > OK, looks to be same mechanism as other meson tests.
> > > 
> > > > 
> > > > Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > > 
> > > As of about an hour or so ago, this patch should not be required.
> > > 
> > >   https://gitlab.alpinelinux.org/alpine/aports/-/issues/13813
> > 
> > I'll take it anyway as protection against any other broken build envs.
> 
> Can you update the commit message at least then.

Sure, I've added:

[dgilbert: This has been fixed in Alpine issue 13813 and liburing]

> The root casue trigger for the bug is the OS uses a busybox

I guess you mean musl??

> impl of mkdtemp, which isn't compat with the args liburing
> configure was previously using. I doubt there are many such OS
> around to be honest, as most will use coreutils.
> 
> With regards,
> Daniel
> -- 
> |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
>
Daniel P. Berrangé May 16, 2022, 2:04 p.m. UTC | #6
On Mon, May 16, 2022 at 01:51:43PM +0100, Dr. David Alan Gilbert wrote:
> * Daniel P. Berrangé (berrange@redhat.com) wrote:
> > On Mon, May 16, 2022 at 12:30:15PM +0100, Dr. David Alan Gilbert wrote:
> > > * Daniel P. Berrangé (berrange@redhat.com) wrote:
> > > > On Mon, May 16, 2022 at 12:13:16PM +0100, Dr. David Alan Gilbert wrote:
> > > > > * Leonardo Bras (leobras@redhat.com) wrote:
> > > > > > A build error happens in alpine CI when linux/errqueue.h is included
> > > > > > in io/channel-socket.c, due to redefining of 'struct __kernel_timespec':
> > > > > 
> > > > > OK, looks to be same mechanism as other meson tests.
> > > > 
> > > > > 
> > > > > Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > > > 
> > > > As of about an hour or so ago, this patch should not be required.
> > > > 
> > > >   https://gitlab.alpinelinux.org/alpine/aports/-/issues/13813
> > > 
> > > I'll take it anyway as protection against any other broken build envs.
> > 
> > Can you update the commit message at least then.
> 
> Sure, I've added:
> 
> [dgilbert: This has been fixed in Alpine issue 13813 and liburing]
> 
> > The root casue trigger for the bug is the OS uses a busybox
> 
> I guess you mean musl??

I don't think it is musl, its the configure shell script and it is
throwing an error from the 'mktemp' command

> > impl of mkdtemp, which isn't compat with the args liburing
> > configure was previously using. I doubt there are many such OS
> > around to be honest, as most will use coreutils.

With regards,
Daniel
diff mbox series

Patch

diff --git a/meson.build b/meson.build
index 9b20dcd143..a996690c9b 100644
--- a/meson.build
+++ b/meson.build
@@ -515,12 +515,23 @@  if not get_option('linux_aio').auto() or have_block
                            required: get_option('linux_aio'),
                            kwargs: static_kwargs)
 endif
+
+linux_io_uring_test = '''
+  #include <liburing.h>
+  #include <linux/errqueue.h>
+
+  int main(void) { return 0; }'''
+
 linux_io_uring = not_found
 if not get_option('linux_io_uring').auto() or have_block
   linux_io_uring = dependency('liburing', version: '>=0.3',
                               required: get_option('linux_io_uring'),
                               method: 'pkg-config', kwargs: static_kwargs)
+  if not cc.links(linux_io_uring_test)
+    linux_io_uring = not_found
+  endif
 endif
+
 libnfs = not_found
 if not get_option('libnfs').auto() or have_block
   libnfs = dependency('libnfs', version: '>=1.9.3',