diff mbox series

[meta-networking] spice: fix build failures with GCC 16

Message ID 20260616111119.353590-1-Hemanth.KumarMD@windriver.com
State Under Review
Headers show
Series [meta-networking] spice: fix build failures with GCC 16 | expand

Commit Message

Hemanth Kumar M D June 16, 2026, 11:11 a.m. UTC
From: Hemanth Kumar M D <Hemanth.KumarMD@windriver.com>

GCC 16 defaults to C++20 which enforces stricter designated
initializer rules. Add patches to fix the two affected test files.

Signed-off-by: Hemanth Kumar M D <Hemanth.KumarMD@windriver.com>
---
 .../0001-test-gst-Fix-compilation-error.patch | 48 +++++++++++++++++++
 .../spice/0002-test-display-base-fix.patch    | 34 +++++++++++++
 .../recipes-support/spice/spice_0.16.0.bb     |  6 ++-
 3 files changed, 86 insertions(+), 2 deletions(-)
 create mode 100644 meta-networking/recipes-support/spice/spice/0001-test-gst-Fix-compilation-error.patch
 create mode 100644 meta-networking/recipes-support/spice/spice/0002-test-display-base-fix.patch
diff mbox series

Patch

diff --git a/meta-networking/recipes-support/spice/spice/0001-test-gst-Fix-compilation-error.patch b/meta-networking/recipes-support/spice/spice/0001-test-gst-Fix-compilation-error.patch
new file mode 100644
index 0000000000..2d9e92924a
--- /dev/null
+++ b/meta-networking/recipes-support/spice/spice/0001-test-gst-Fix-compilation-error.patch
@@ -0,0 +1,48 @@ 
+From a904cd86430aa555a50730e9389e210637a546c1 Mon Sep 17 00:00:00 2001
+From: Frediano Ziglio <freddy77@gmail.com>
+Date: Thu, 29 Jan 2026 08:28:16 +0000
+Subject: [PATCH] test-gst: Fix compilation error
+MIME-Version: 1.0
+Content-Type: text/plain; charset=utf-8
+Content-Transfer-Encoding: 8bit
+
+Specifically:
+
+../server/tests/test-gst.cpp: In function ‘TestPipeline* create_pipeline(const char*, SampleProc, void*)’:
+../server/tests/test-gst.cpp:566:41: error: either all initializer clauses should be designated or none of them should be
+  566 |         { NULL, NULL, new_sample, NULL, ._gst_reserved={NULL} };
+      |                                         ^
+
+This fixes https://gitlab.freedesktop.org/spice/spice/-/issues/96.
+
+Upstream-Status: Backport [https://gitlab.freedesktop.org/spice/spice/-/commit/a904cd86430aa555a50730e9389e210637a546c]
+
+Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
+Signed-off-by: Hemanth Kumar M D <Hemanth.KumarMD@windriver.com>
+---
+ server/tests/test-gst.cpp | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+diff --git a/server/tests/test-gst.cpp b/server/tests/test-gst.cpp
+index 5d920d7d..19ad879b 100644
+--- a/server/tests/test-gst.cpp
++++ b/server/tests/test-gst.cpp
+@@ -561,13 +561,8 @@ create_pipeline(const char *desc, SampleProc sample_proc, void *param)
+         return NULL;
+     }
+ 
+-    static const GstAppSinkCallbacks appsink_cbs_template =
+-#if GST_CHECK_VERSION(1, 20, 0)
+-        { NULL, NULL, new_sample, NULL, ._gst_reserved={NULL} };
+-#else
+-        { NULL, NULL, new_sample, ._gst_reserved={NULL} };
+-#endif
+-    GstAppSinkCallbacks appsink_cbs = appsink_cbs_template;
++    GstAppSinkCallbacks appsink_cbs{};
++    appsink_cbs.new_sample = new_sample;
+     gst_app_sink_set_callbacks(pipeline->appsink, &appsink_cbs, pipeline, NULL);
+ 
+     GstBus *bus = gst_element_get_bus(pipeline->gst_pipeline);
+-- 
+2.49.0
+
diff --git a/meta-networking/recipes-support/spice/spice/0002-test-display-base-fix.patch b/meta-networking/recipes-support/spice/spice/0002-test-display-base-fix.patch
new file mode 100644
index 0000000000..a0df6a430d
--- /dev/null
+++ b/meta-networking/recipes-support/spice/spice/0002-test-display-base-fix.patch
@@ -0,0 +1,34 @@ 
+From: Nicholas Vinson <nvinson234@gmail.com>
+Date: Mon, 08 Dec 2025 00:33:52 -0800
+Subject: [PATCH] test-display-base.cpp: adjust designated init for C++20
+
+Adjust designated initializer to be C++20 compliant. Starting with
+g++-16, GCC will default to the C++20 standard.
+
+Note: v3 was acked by the maintainer on the spice-devel mailing list
+in December 2025 but was never merged.
+
+Upstream-Status: Submitted [https://www.mail-archive.com/spice-devel@lists.freedesktop.org/msg53355.html]
+
+Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
+Signed-off-by: Hemanth Kumar M D <Hemanth.KumarMD@windriver.com>
+
+---
+ server/tests/test-display-base.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/server/tests/test-display-base.cpp b/server/tests/test-display-base.cpp
+index b220b7fe..5d0404c9 100644
+--- a/server/tests/test-display-base.cpp
++++ b/server/tests/test-display-base.cpp
+@@ -806,7 +806,7 @@ static QXLInterface display_sif = {
+         .major_version = SPICE_INTERFACE_QXL_MAJOR,
+         .minor_version = SPICE_INTERFACE_QXL_MINOR
+     },
+-    { .attached_worker = attached_worker },
++    .attached_worker = attached_worker,
+     .set_compression_level = set_compression_level,
+     .set_mm_time = nullptr,
+     .get_init_info = get_init_info,
+--
+2.52.0
diff --git a/meta-networking/recipes-support/spice/spice_0.16.0.bb b/meta-networking/recipes-support/spice/spice_0.16.0.bb
index 6ae63091b3..3d7788f749 100644
--- a/meta-networking/recipes-support/spice/spice_0.16.0.bb
+++ b/meta-networking/recipes-support/spice/spice_0.16.0.bb
@@ -15,8 +15,10 @@  LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
 
 SRCREV = "a6668fff651726e5d4cfd52cbf8669540970452c"
 
-SRC_URI = "gitsm://gitlab.freedesktop.org/spice/spice;branch=master;protocol=https;tag=v0.16.0"
-
+SRC_URI = "gitsm://gitlab.freedesktop.org/spice/spice;branch=master;protocol=https;tag=v0.16.0 \
+           file://0001-test-gst-Fix-compilation-error.patch \  
+           file://0002-test-display-base-fix.patch \
+"
 
 CVE_STATUS[CVE-2016-0749] = "fixed-version: patched since 0.13.2"
 CVE_STATUS[CVE-2016-2150] = "fixed-version: patched since 0.13.2"