On Thu, Sep 5, 2024 at 12:41 PM Bruce Ashfield via
lists.yoctoproject.org
<[email protected]> wrote:
>
> I'm not sure that I want to support libvirt on qemuarm .. but
> since the patch isn't too complicated, I've gone ahead and
> merged it

The problem is generic 32bit systems with 64bit time_t, I guess will exhibit the
same problem, so the fix is more than qemuarm

>
> Bruce
>
> In message: [meta-virtualization][PATCH] libvirt: fix build on qemuarm
> on 03/09/2024 Chen Qi via lists.yoctoproject.org wrote:
>
> > From: Chen Qi <[email protected]>
> >
> > On qemuarm, time_t is 'long long int', so using '%lu' to print
> > it out will give us the following error:
> >
> >     error: format '%lu' expects argument of type 'long unsigned int',
> >     but argument 10 has type 'time_t' {aka 'long long int'} 
> > [-Werror=format=]
> >
> > So use %llu to print it out.
> >
> > Signed-off-by: Chen Qi <[email protected]>
> > ---
> >  ...emu_nbdkit.c-use-llu-to-print-time_t.patch | 76 +++++++++++++++++++
> >  recipes-extended/libvirt/libvirt_git.bb       |  1 +
> >  2 files changed, 77 insertions(+)
> >  create mode 100644 
> > recipes-extended/libvirt/libvirt/0001-qemu_nbdkit.c-use-llu-to-print-time_t.patch
> >
> > diff --git 
> > a/recipes-extended/libvirt/libvirt/0001-qemu_nbdkit.c-use-llu-to-print-time_t.patch
> >  
> > b/recipes-extended/libvirt/libvirt/0001-qemu_nbdkit.c-use-llu-to-print-time_t.patch
> > new file mode 100644
> > index 00000000..7263666a
> > --- /dev/null
> > +++ 
> > b/recipes-extended/libvirt/libvirt/0001-qemu_nbdkit.c-use-llu-to-print-time_t.patch
> > @@ -0,0 +1,76 @@
> > +From c4636402c06ab5ae436176daf0ef17005346e27d Mon Sep 17 00:00:00 2001
> > +From: Chen Qi <[email protected]>
> > +Date: Mon, 2 Sep 2024 22:15:51 -0700
> > +Subject: [PATCH] qemu_nbdkit.c: use %llu to print time_t
> > +
> > +Use %lu to print time_t will give use the following error:
> > +
> > +  error: format '%lu' expects argument of type 'long unsigned int',
> > +  but argument 10 has type 'time_t' {aka 'long long int'} [-Werror=format=]
> > +
> > +So use %llu to print time_t.
> > +
> > +Upstream-Status: Submitted 
> > [https://lists.libvirt.org/archives/list/[email protected]/thread/FQSQMML6VWMHNWBYP67OLCUTJY5LJQST/]
> > +
> > +Signed-off-by: Chen Qi <[email protected]>
> > +---
> > + src/qemu/qemu_nbdkit.c | 24 ++++++++++++------------
> > + 1 file changed, 12 insertions(+), 12 deletions(-)
> > +
> > +diff --git a/src/qemu/qemu_nbdkit.c b/src/qemu/qemu_nbdkit.c
> > +index f099f35e1e..fe660c78e5 100644
> > +--- a/src/qemu/qemu_nbdkit.c
> > ++++ b/src/qemu/qemu_nbdkit.c
> > +@@ -544,18 +544,18 @@ qemuNbdkitCapsFormatCache(qemuNbdkitCaps *nbdkitCaps)
> > +
> > +     virBufferEscapeString(&buf, "<path>%s</path>\n",
> > +                           nbdkitCaps->path);
> > +-    virBufferAsprintf(&buf, "<nbdkitctime>%lu</nbdkitctime>\n",
> > +-                      nbdkitCaps->ctime);
> > ++    virBufferAsprintf(&buf, "<nbdkitctime>%llu</nbdkitctime>\n",
> > ++                      (long long)nbdkitCaps->ctime);
> > +     virBufferEscapeString(&buf, "<plugindir>%s</plugindir>\n",
> > +                           nbdkitCaps->pluginDir);
> > +-    virBufferAsprintf(&buf, "<plugindirmtime>%lu</plugindirmtime>\n",
> > +-                      nbdkitCaps->pluginDirMtime);
> > ++    virBufferAsprintf(&buf, "<plugindirmtime>%llu</plugindirmtime>\n",
> > ++                      (long long)nbdkitCaps->pluginDirMtime);
> > +     virBufferEscapeString(&buf, "<filterdir>%s</filterdir>\n",
> > +                           nbdkitCaps->filterDir);
> > +-    virBufferAsprintf(&buf, "<filterdirmtime>%lu</filterdirmtime>\n",
> > +-                      nbdkitCaps->filterDirMtime);
> > +-    virBufferAsprintf(&buf, "<selfctime>%lu</selfctime>\n",
> > +-                      nbdkitCaps->libvirtCtime);
> > ++    virBufferAsprintf(&buf, "<filterdirmtime>%llu</filterdirmtime>\n",
> > ++                      (long long)nbdkitCaps->filterDirMtime);
> > ++    virBufferAsprintf(&buf, "<selfctime>%llu</selfctime>\n",
> > ++                      (long long)nbdkitCaps->libvirtCtime);
> > +     virBufferAsprintf(&buf, "<selfvers>%u</selfvers>\n",
> > +                       nbdkitCaps->libvirtVersion);
> > +
> > +@@ -593,10 +593,10 @@ virNbdkitCapsSaveFile(void *data,
> > +         return -1;
> > +     }
> > +
> > +-    VIR_DEBUG("Saved caps '%s' for '%s' with (%lu, %lu)",
> > ++    VIR_DEBUG("Saved caps '%s' for '%s' with (%llu, %llu)",
> > +               filename, nbdkitCaps->path,
> > +-              nbdkitCaps->ctime,
> > +-              nbdkitCaps->libvirtCtime);
> > ++              (long long)nbdkitCaps->ctime,
> > ++              (long long)nbdkitCaps->libvirtCtime);
> > +
> > +     return 0;
> > + }
> > +@@ -1054,7 +1054,7 @@ qemuNbdkitProcessBuildCommandCurl(qemuNbdkitProcess 
> > *proc,
> > +     }
> > +
> > +     if (proc->source->timeout > 0) {
> > +-        g_autofree char *timeout = g_strdup_printf("%llu", 
> > proc->source->timeout);
> > ++        g_autofree char *timeout = g_strdup_printf("%llu", (long 
> > long)proc->source->timeout);
> > +         virCommandAddArgPair(cmd, "timeout", timeout);
> > +     }
> > +
> > +--
> > +2.25.1
> > +
> > diff --git a/recipes-extended/libvirt/libvirt_git.bb 
> > b/recipes-extended/libvirt/libvirt_git.bb
> > index 706d4a40..d57bdc11 100644
> > --- a/recipes-extended/libvirt/libvirt_git.bb
> > +++ b/recipes-extended/libvirt/libvirt_git.bb
> > @@ -39,6 +39,7 @@ SRC_URI = 
> > "gitsm://github.com/libvirt/libvirt.git;name=libvirt;protocol=https;br
> >             
> > file://0001-messon.build-remove-build-path-information-to-avoid-.patch \
> >             
> > file://0001-meson.build-clear-abs_top_builddir-to-avoid-QA-warni.patch \
> >             file://0001-tests-meson-clear-absolute-directory-paths.patch \
> > +           file://0001-qemu_nbdkit.c-use-llu-to-print-time_t.patch \
> >            "
> >
> >  S = "${WORKDIR}/git"
> > --
> > 2.25.1
> >
>
> >
> >
> >
>
>
> 
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8870): 
https://lists.yoctoproject.org/g/meta-virtualization/message/8870
Mute This Topic: https://lists.yoctoproject.org/mt/108257527/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to