All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-virtualization][PATCH] libvirt: fix build on qemuarm
@ 2024-09-04  1:30 Qi.Chen
  2024-09-05 19:41 ` Bruce Ashfield
  0 siblings, 1 reply; 3+ messages in thread
From: Qi.Chen @ 2024-09-04  1:30 UTC (permalink / raw)
  To: meta-virtualization

From: Chen Qi <Qi.Chen@windriver.com>

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 <Qi.Chen@windriver.com>
---
 ...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 <Qi.Chen@windriver.com>
+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/devel@lists.libvirt.org/thread/FQSQMML6VWMHNWBYP67OLCUTJY5LJQST/]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ 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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [meta-virtualization][PATCH] libvirt: fix build on qemuarm
  2024-09-04  1:30 [meta-virtualization][PATCH] libvirt: fix build on qemuarm Qi.Chen
@ 2024-09-05 19:41 ` Bruce Ashfield
  2024-09-05 19:49   ` Khem Raj
  0 siblings, 1 reply; 3+ messages in thread
From: Bruce Ashfield @ 2024-09-05 19:41 UTC (permalink / raw)
  To: Qi.Chen; +Cc: meta-virtualization

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

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 <Qi.Chen@windriver.com>
> 
> 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 <Qi.Chen@windriver.com>
> ---
>  ...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 <Qi.Chen@windriver.com>
> +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/devel@lists.libvirt.org/thread/FQSQMML6VWMHNWBYP67OLCUTJY5LJQST/]
> +
> +Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> +---
> + 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 (#8866): https://lists.yoctoproject.org/g/meta-virtualization/message/8866
> Mute This Topic: https://lists.yoctoproject.org/mt/108257527/1050810
> Group Owner: meta-virtualization+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [bruce.ashfield@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [meta-virtualization][PATCH] libvirt: fix build on qemuarm
  2024-09-05 19:41 ` Bruce Ashfield
@ 2024-09-05 19:49   ` Khem Raj
  0 siblings, 0 replies; 3+ messages in thread
From: Khem Raj @ 2024-09-05 19:49 UTC (permalink / raw)
  To: bruce.ashfield; +Cc: Qi.Chen, meta-virtualization

On Thu, Sep 5, 2024 at 12:41 PM Bruce Ashfield via
lists.yoctoproject.org
<bruce.ashfield=gmail.com@lists.yoctoproject.org> 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 <Qi.Chen@windriver.com>
> >
> > 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 <Qi.Chen@windriver.com>
> > ---
> >  ...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 <Qi.Chen@windriver.com>
> > +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/devel@lists.libvirt.org/thread/FQSQMML6VWMHNWBYP67OLCUTJY5LJQST/]
> > +
> > +Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> > +---
> > + 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 (#8869): https://lists.yoctoproject.org/g/meta-virtualization/message/8869
> Mute This Topic: https://lists.yoctoproject.org/mt/108257527/1997914
> Group Owner: meta-virtualization+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-05 19:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-04  1:30 [meta-virtualization][PATCH] libvirt: fix build on qemuarm Qi.Chen
2024-09-05 19:41 ` Bruce Ashfield
2024-09-05 19:49   ` Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.