[oe] [meta-networking][PATCHv2] spice: fix compile errors on 32bit system

Martin Jansa martin.jansa at gmail.com
Thu Jun 13 16:29:34 UTC 2019


From: "Hongzhi.Song" <hongzhi.song at windriver.com>

There are folowing compile errors on Linux 32bit system:

red-channel.c:207:73: error: format '%x' expects argument of type
'unsigned int', but argument 7 has type 'long unsigned int' [-Werror=format=]
|207| red_channel_debug(self, "thread_id 0x%" G_GSIZE_MODIFIER "x",
                                ~~~~~~~~~~~~~~~~~~~~~^
                        self->priv->thread_id);
                ~~~~~~~~~~~~~~~~~~~~~^

On 32bit system, #define G_GSIZE_MODIFIER "". But the type of
'self->priv->thread_id' is 'unsigned long int' which should match '%lx'
not '%x'.

So we should recovery the <0x%" G_GSIZE_MODIFIER "x"> to <0x%lx">.
And others files modification are similar to G_GSIZE_MODIFIER.

Signed-off-by: Hongzhi.Song <hongzhi.song at windriver.com>
Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>
---

v2: fixed Upstream-Status

---
 ...compile-errors-on-Linux-32bit-system.patch | 96 +++++++++++++++++++
 .../recipes-support/spice/spice_git.bb        |  1 +
 2 files changed, 97 insertions(+)
 create mode 100644 meta-networking/recipes-support/spice/spice/0001-Fix-compile-errors-on-Linux-32bit-system.patch

diff --git a/meta-networking/recipes-support/spice/spice/0001-Fix-compile-errors-on-Linux-32bit-system.patch b/meta-networking/recipes-support/spice/spice/0001-Fix-compile-errors-on-Linux-32bit-system.patch
new file mode 100644
index 0000000000..d04bee95fa
--- /dev/null
+++ b/meta-networking/recipes-support/spice/spice/0001-Fix-compile-errors-on-Linux-32bit-system.patch
@@ -0,0 +1,96 @@
+From a2af005b5d4a62839e56f42a43df793356e78f58 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" <hongzhi.song at windriver.com>
+Date: Tue, 4 Jun 2019 03:58:17 -0400
+Subject: [PATCH] Fix compile errors on Linux 32bit system
+
+There are folowing compile errors on Linux 32bit system:
+
+red-channel.c:207:73: error: format '%x' expects argument of type
+'unsigned int', but argument 7 has type 'long unsigned int' [-Werror=format=]
+|207| red_channel_debug(self, "thread_id 0x%" G_GSIZE_MODIFIER "x",
+                                ~~~~~~~~~~~~~~~~~~~~~^
+                        self->priv->thread_id);
+                ~~~~~~~~~~~~~~~~~~~~~^
+
+On 32bit system, #define G_GSIZE_MODIFIER "". But the type of
+'self->priv->thread_id' is 'unsigned long int' which should match '%lx'
+not '%x'.
+
+So we should recovery the <0x%" G_GSIZE_MODIFIER "x"> to <0x%lx">.
+And others files modification are similar to G_GSIZE_MODIFIER.
+
+Signed-off-by: Hongzhi.Song <hongzhi.song at windriver.com>
+---
+Upstream-Status: Submitted [https://lists.freedesktop.org/archives/spice-devel/2019-June/049285.html]
+
+ server/red-channel.c    | 6 +++---
+ server/red-client.c     | 8 ++++----
+ server/red-replay-qxl.c | 2 +-
+ 3 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/server/red-channel.c b/server/red-channel.c
+index f81142d..6a03ec2 100644
+--- a/server/red-channel.c
++++ b/server/red-channel.c
+@@ -202,7 +202,7 @@ red_channel_constructed(GObject *object)
+ {
+     RedChannel *self = RED_CHANNEL(object);
+ 
+-    red_channel_debug(self, "thread_id 0x%" G_GSIZE_MODIFIER "x", (unsigned long)self->priv->thread_id);
++    red_channel_debug(self, "thread_id 0x%lx", (unsigned long)self->priv->thread_id);
+ 
+     RedChannelClass *klass = RED_CHANNEL_GET_CLASS(self);
+ 
+@@ -473,8 +473,8 @@ void red_channel_remove_client(RedChannel *channel, RedChannelClient *rcc)
+ 
+     if (!pthread_equal(pthread_self(), channel->priv->thread_id)) {
+         red_channel_warning(channel,
+-                            "channel->thread_id (0x%" G_GSIZE_MODIFIER "x) != "
+-                            "pthread_self (0x%" G_GSIZE_MODIFIER "x)."
++                            "channel->thread_id (0x%lx) != "
++                            "pthread_self (0x%lx)."
+                             "If one of the threads is != io-thread && != vcpu-thread, "
+                             "this might be a BUG",
+                             (unsigned long)channel->priv->thread_id,
+diff --git a/server/red-client.c b/server/red-client.c
+index 2b859cb..ff4da2a 100644
+--- a/server/red-client.c
++++ b/server/red-client.c
+@@ -174,8 +174,8 @@ void red_client_migrate(RedClient *client)
+     RedChannel *channel;
+ 
+     if (!pthread_equal(pthread_self(), client->thread_id)) {
+-        spice_warning("client->thread_id (0x%" G_GSIZE_MODIFIER "x) != "
+-                      "pthread_self (0x%" G_GSIZE_MODIFIER "x)."
++        spice_warning("client->thread_id (0x%lx) != "
++                      "pthread_self (0x%lx)."
+                       "If one of the threads is != io-thread && != vcpu-thread,"
+                       " this might be a BUG",
+                       (unsigned long)client->thread_id, (unsigned long)pthread_self());
+@@ -193,8 +193,8 @@ void red_client_destroy(RedClient *client)
+     RedChannelClient *rcc;
+ 
+     if (!pthread_equal(pthread_self(), client->thread_id)) {
+-        spice_warning("client->thread_id (0x%" G_GSIZE_MODIFIER "x) != "
+-                      "pthread_self (0x%" G_GSIZE_MODIFIER "x)."
++        spice_warning("client->thread_id (0x%lx) != "
++                      "pthread_self (0x%lx)."
+                       "If one of the threads is != io-thread && != vcpu-thread,"
+                       " this might be a BUG",
+                       (unsigned long)client->thread_id,
+diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
+index 6d34818..0deb406 100644
+--- a/server/red-replay-qxl.c
++++ b/server/red-replay-qxl.c
+@@ -264,7 +264,7 @@ static replay_t read_binary(SpiceReplay *replay, const char *prefix, size_t *siz
+             exit(1);
+         }
+         if ((ret = inflate(&strm, Z_NO_FLUSH)) != Z_STREAM_END) {
+-            spice_error("inflate error %d (disc: %" G_GSSIZE_FORMAT ")",
++            spice_error("inflate error %d (disc: %li)",
+                         ret, *size - strm.total_out);
+             if (ret == Z_DATA_ERROR) {
+                 /* last operation may be wrong. since we do the recording
+-- 
+2.8.1
+
diff --git a/meta-networking/recipes-support/spice/spice_git.bb b/meta-networking/recipes-support/spice/spice_git.bb
index b0fab0d65f..552f81df0a 100644
--- a/meta-networking/recipes-support/spice/spice_git.bb
+++ b/meta-networking/recipes-support/spice/spice_git.bb
@@ -24,6 +24,7 @@ SRC_URI = " \
     git://anongit.freedesktop.org/spice/spice;name=spice \
     git://anongit.freedesktop.org/spice/spice-common;destsuffix=git/subprojects/spice-common;name=spice-common \
     file://0001-Convert-pthread_t-to-be-numeric.patch \
+    file://0001-Fix-compile-errors-on-Linux-32bit-system.patch \
 "
 
 S = "${WORKDIR}/git"
-- 
2.17.1



More information about the Openembedded-devel mailing list