From: David Turner <digit@google.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH 1/3] Fix libvhost-user.c compilation.
Date: Fri, 7 Apr 2023 11:24:30 +0200 [thread overview]
Message-ID: <CACnJMqpF9FPwtZz3Uj_amCbrRtQo7WWPm0bY_qy=80+ihb8Uhw@mail.gmail.com> (raw)
In-Reply-To: <20230407035709-mutt-send-email-mst@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 4836 bytes --]
The <linux/vhost.h> of glib-2.17 begins with:
#ifndef _LINUX_VHOST_H
#define _LINUX_VHOST_H
/* Userspace interface for in-kernel virtio accelerators. */
/* vhost is used to reduce the number of system calls involved in virtio.
*
* Existing virtio net code is used in the guest without modification.
*
* This header includes interface used by userspace hypervisor for
* device configuration.
*/
#include <linux/types.h>
#include <linux/ioctl.h>
#include <linux/virtio_config.h>
#include <linux/virtio_ring.h>
See
https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/+/refs/heads/master/sysroot/usr/include/linux/vhost.h
Here's the compilation error I get in this case:
FAILED: subprojects/libvhost-user/libvhost-user.a.p/libvhost-user.c.o
/src/prebuilts/clang/clang-r487747/bin/clang --sysroot=/out/sysroot -m64
-mcx16 -Isubprojects/libvhost-user/libvhost-user.a.p
-Isubprojects/libvhost-user -I../../
src/third_party/qemu/subprojects/libvhost-user
-I/out/dest-install/usr/include -fcolor-diagnostics -Wall -Winvalid-pch
-std=gnu99 -O2 -g -Wsign-compare -Wdeclarat
ion-after-statement -Wstrict-aliasing -fno-pie -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -fno-strict-aliasing -fno-common -fwrapv -Wundef
-Wwrite-strings -Wmissi
ng-prototypes -Wstrict-prototypes -Wredundant-decls -Wold-style-definition
-Wtype-limits -Wformat-security -Wformat-y2k -Winit-self
-Wignored-qualifiers -Wempty-b
ody -Wnested-externs -Wendif-labels -Wexpansion-to-defined
-Wmissing-format-attribute -Wthread-safety -Wno-initializer-overrides
-Wno-missing-include-dirs -Wno-sh
ift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition
-Wno-tautological-type-limit-compare -Wno-psabi
-Wno-gnu-variable-sized-type-not-at-end -fstack-
protector-strong -pthread -D_GNU_SOURCE -MD -MQ
subprojects/libvhost-user/libvhost-user.a.p/libvhost-user.c.o -MF
subprojects/libvhost-user/libvhost-user.a.p/libv
host-user.c.o.d -o
subprojects/libvhost-user/libvhost-user.a.p/libvhost-user.c.o -c
../../src/third_party/qemu/subprojects/libvhost-user/libvhost-user.c
../../src/third_party/qemu/subprojects/libvhost-user/libvhost-user.c:529:17:
error: use of undeclared identifier 'VIRTIO_F_VERSION_1'
1ULL << VIRTIO_F_VERSION_1 |
^
../../src/third_party/qemu/subprojects/libvhost-user/libvhost-user.c:563:30:
error: use of undeclared identifier 'VIRTIO_F_VERSION_1'
if (!vu_has_feature(dev, VIRTIO_F_VERSION_1)) {
^
../../src/third_party/qemu/subprojects/libvhost-user/libvhost-user.c:632:22:
warning: unused variable 'dev_region' [-Wunused-variable]
VuDevRegion *dev_region = &dev->regions[i];
^
../../src/third_party/qemu/subprojects/libvhost-user/libvhost-user.c:633:13:
warning: unused variable 'ret' [-Wunused-variable]
int ret;
^
2 warnings and 2 errors generated.
On Fri, Apr 7, 2023 at 10:03 AM Michael S. Tsirkin <mst@redhat.com> wrote:
> If you are reposting, please version patchsets, E.g.
> -v2 flag for git format-patch will enerate [PATCH v2] for you.
>
> Repeating what I said on previous version:
>
> On Wed, Apr 05, 2023 at 07:21:07PM +0200, David 'Digit' Turner wrote:
> > The source file uses VIRTIO_F_VERSION_1 which is
> > not defined by <linux/virtio_config.h> on Debian 10.
> >
> > The system-provided <linux/virtio_config.h> which
> > does not include the macro definition is included
> > through <linux/vhost.h>, so fix the issue by including
> > the standard-headers version before that.
> >
> > Signed-off-by: David 'Digit' Turner <digit@google.com>
>
> This happens to work usually but there's no guarantee
> "standard-headers/linux/virtio_config.h"
> and <linux/virtio_config.h> are interchangeable or
> even do not conflict.
>
> But where is <linux/vhost.h> using <linux/virtio_config.h>?
> Everyone should be using "standard-headers/linux/virtio_config.h".
>
>
> > ---
> > subprojects/libvhost-user/libvhost-user.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/subprojects/libvhost-user/libvhost-user.c
> b/subprojects/libvhost-user/libvhost-user.c
> > index 0200b78e8e..0a5768cb55 100644
> > --- a/subprojects/libvhost-user/libvhost-user.c
> > +++ b/subprojects/libvhost-user/libvhost-user.c
> > @@ -32,6 +32,12 @@
> > #include <sys/mman.h>
> > #include <endian.h>
> >
> > +/* Necessary to provide VIRTIO_F_VERSION_1 on system
> > + * with older linux headers. Must appear before
> > + * <linux/vhost.h> below.
> > + */
> > +#include "standard-headers/linux/virtio_config.h"
> > +
> > #if defined(__linux__)
> > #include <sys/syscall.h>
> > #include <fcntl.h>
> > --
> > 2.40.0.348.gf938b09366-goog
>
>
[-- Attachment #2: Type: text/html, Size: 7253 bytes --]
next prev parent reply other threads:[~2023-04-07 9:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-05 17:21 [PATCH v2] Fix QEMU compilation on Debian 10 David 'Digit' Turner
2023-04-05 17:21 ` [PATCH 1/3] Fix libvhost-user.c compilation David 'Digit' Turner
2023-04-07 8:03 ` Michael S. Tsirkin
2023-04-07 9:24 ` David Turner [this message]
2023-04-07 9:25 ` David Turner
2023-04-07 9:29 ` David Turner
2023-04-07 9:46 ` Michael S. Tsirkin
2023-04-07 9:49 ` David Turner
2023-04-07 9:47 ` David Turner
2023-04-07 10:01 ` Michael S. Tsirkin
2023-04-18 8:47 ` Daniel P. Berrangé
2023-04-18 11:04 ` David Turner
2023-04-18 11:47 ` Michael S. Tsirkin
2023-04-05 17:21 ` [PATCH 2/3] update-linux-headers.sh: Add missing kernel headers David 'Digit' Turner
2023-04-05 17:21 ` [PATCH 3/3] Update linux headers to v6.3rc5 David 'Digit' Turner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACnJMqpF9FPwtZz3Uj_amCbrRtQo7WWPm0bY_qy=80+ihb8Uhw@mail.gmail.com' \
--to=digit@google.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).