[meta-multimedia][PATCH 5/8] gerbera: fix build against fmt 12.2.0

Khem Raj <[email protected]>
Newsgroups org.openembedded.lists.openembedded-devel
Message-ID <[email protected]>
fmt 12.2.0 turns <fmt/core.h> into a shim that only pulls in
<fmt/base.h>, which no longer declares fmt::format() and no longer drags
in <cstring> transitively. gerbera 3.0.0 relied on both, so do_compile
fails first with:

  src/exceptions.cc:37:31: error: no member named 'format' in namespace 'fmt'

and, once that is addressed, with a second wave of:

  src/util/thread_runner.h:194:68: error: no member named 'strerror' in namespace 'std'
  src/content/inotify/mt_inotify.cc:163:13: error: no member named 'memcpy' in namespace 'std'
  src/util/url_utils.cc:144:24: error: no member named 'strchr' in namespace 'std'

Add two backport patches:

* 0001 switches the central headers exceptions.h and search_handler.h
  from <fmt/core.h> to <fmt/format.h> (upstream commit 9507706136fd).
* 0002 adds an explicit #include <cstring> to every translation unit
  that uses std::strerror/std::memcpy/std::strchr (based on upstream
  commit 7caa9ae9ebf5, extended to cover all affected files in this
  release).

Neither fix is in any released gerbera tag (both are master-only), so a
version bump would not help; backporting is the least invasive option.

Signed-off-by: Khem Raj <[email protected]>
---
 ...-against-fmt-12-include-fmt-format.h.patch |  53 +++++
 ...-cstring-for-std-strerror-std-memcpy.patch | 204 ++++++++++++++++++
 .../gerbera/gerbera_3.0.0.bb                  |   5 +-
 3 files changed, 261 insertions(+), 1 deletion(-)
 create mode 100644 meta-multimedia/recipes-multimedia/gerbera/gerbera/0001-fix-build-against-fmt-12-include-fmt-format.h.patch
 create mode 100644 meta-multimedia/recipes-multimedia/gerbera/gerbera/0002-include-cstring-for-std-strerror-std-memcpy.patch

diff --git a/meta-multimedia/recipes-multimedia/gerbera/gerbera/0001-fix-build-against-fmt-12-include-fmt-format.h.patch b/meta-multimedia/recipes-multimedia/gerbera/gerbera/0001-fix-build-against-fmt-12-include-fmt-format.h.patch
new file mode 100644
index 0000000000..eaaf7869e5
--- /dev/null
+++ b/meta-multimedia/recipes-multimedia/gerbera/gerbera/0001-fix-build-against-fmt-12-include-fmt-format.h.patch
@@ -0,0 +1,53 @@
+From 9507706136fd0000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Wed, 8 Jul 2026 00:00:00 +0000
+Subject: [PATCH] fix build against fmt 12: include fmt/format.h
+
+Since fmt 11, <fmt/core.h> is a thin shim that only pulls in <fmt/base.h>
+and no longer declares fmt::format() unless FMT_DEPRECATED_HEAVY_CORE is
+defined. fmt 12.2.0 finishes the job and the build fails with:
+
+  src/exceptions.cc:37:31: error: no member named 'format' in namespace 'fmt'
+      : std::runtime_error(fmt::format("{}: Error: {}", message, userMessage))
+
+Include <fmt/format.h> in the central headers that expose fmt::format()
+to the rest of the tree (exceptions.h via throw_std_runtime_error, and
+search_handler.h) so all consumers see the declaration again.
+
+Backport of gerbera commit 9507706136fd.
+
+Upstream-Status: Backport [https://github.com/gerbera/gerbera/commit/9507706136fd]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/exceptions.h            | 2 +-
+ src/database/search_handler.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/exceptions.h b/src/exceptions.h
+index 1111111..2222222 100644
+--- a/src/exceptions.h
++++ b/src/exceptions.h
+@@ -34,7 +34,7 @@
+ #ifndef __EXCEPTIONS_H__
+ #define __EXCEPTIONS_H__
+
+-#include <fmt/core.h>
++#include <fmt/format.h>
+ #include <stdexcept>
+ #include <string>
+
+diff --git a/src/database/search_handler.h b/src/database/search_handler.h
+index 3333333..4444444 100644
+--- a/src/database/search_handler.h
++++ b/src/database/search_handler.h
+@@ -32,7 +32,7 @@
+ #include "util/tools.h"
+
+ #include <algorithm>
+-#include <fmt/core.h>
++#include <fmt/format.h>
+ #include <map>
+ #include <memory>
+ #include <tuple>
+--
+2.43.0
diff --git a/meta-multimedia/recipes-multimedia/gerbera/gerbera/0002-include-cstring-for-std-strerror-std-memcpy.patch b/meta-multimedia/recipes-multimedia/gerbera/gerbera/0002-include-cstring-for-std-strerror-std-memcpy.patch
new file mode 100644
index 0000000000..14742f4727
--- /dev/null
+++ b/meta-multimedia/recipes-multimedia/gerbera/gerbera/0002-include-cstring-for-std-strerror-std-memcpy.patch
@@ -0,0 +1,204 @@
+From 7caa9ae9ebf50000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Wed, 8 Jul 2026 00:00:01 +0000
+Subject: [PATCH] include <cstring> for std::strerror / std::memcpy / std::strchr
+
+Several translation units use std::strerror(), std::memcpy() and
+std::strchr() but relied on <cstring> being pulled in transitively
+through <fmt/core.h> (and other headers). With fmt 12 the fmt headers no
+longer drag in <cstring>, so the build fails with:
+
+  src/util/thread_runner.h:194:68: error: no member named 'strerror' in namespace 'std'
+  src/content/inotify/mt_inotify.cc:163:13: error: no member named 'memcpy' in namespace 'std'
+  src/util/url_utils.cc:144:24: error: no member named 'strchr' in namespace 'std'
+
+Include <cstring> explicitly in every file that uses these functions.
+
+Based on upstream gerbera commit 7caa9ae9ebf5, extended to cover all
+affected translation units in this release.
+
+Upstream-Status: Backport [https://github.com/gerbera/gerbera/commit/7caa9ae9ebf5]
+Signed-off-by: Khem Raj <[email protected]>
+---
+--- a/src/main.cc
++++ b/src/main.cc
+@@ -40,6 +40,7 @@
+ #define GRB_LOG_FAC GrbLogFacility::server
+
+ #include "config/config_definition.h"
++#include <cstring>
+ #include "config/config_manager.h"
+ #include "config/config_val.h"
+ #include "config/grb_runtime.h"
+--- a/src/database/sqlite3/sqlite_database.cc
++++ b/src/database/sqlite3/sqlite_database.cc
+@@ -33,6 +33,7 @@
+ #define GRB_LOG_FAC GrbLogFacility::sqlite3
+
+ #include "sqlite_database.h" // API
++#include <cstring>
+
+ #include "cds/cds_enums.h"
+ #include "config/config.h"
+--- a/src/database/postgres/postgres_database.cc
++++ b/src/database/postgres/postgres_database.cc
+@@ -25,6 +25,7 @@
+
+ #ifdef HAVE_PGSQL
+ #include "postgres_database.h" // API
++#include <cstring>
+
+ #include "cds/cds_enums.h"
+ #include "config/config.h"
+--- a/src/iohandler/mem_io_handler.cc
++++ b/src/iohandler/mem_io_handler.cc
+@@ -33,6 +33,7 @@
+ #define GRB_LOG_FAC GrbLogFacility::iohandler
+
+ #include "mem_io_handler.h" // API
++#include <cstring>
+
+ #include "exceptions.h"
+
+--- a/src/iohandler/process_io_handler.cc
++++ b/src/iohandler/process_io_handler.cc
+@@ -33,6 +33,7 @@
+ #define GRB_LOG_FAC GrbLogFacility::iohandler
+
+ #include "process_io_handler.h" // API
++#include <cstring>
+
+ #include "content/content.h"
+ #include "exceptions.h"
+--- a/src/iohandler/curl_io_handler.cc
++++ b/src/iohandler/curl_io_handler.cc
+@@ -34,6 +34,7 @@
+
+ #ifdef HAVE_CURL
+ #include "curl_io_handler.h" // API
++#include <cstring>
+
+ #include "config/config.h"
+ #include "exceptions.h"
+--- a/src/config/grb_runtime.cc
++++ b/src/config/grb_runtime.cc
+@@ -22,6 +22,7 @@
+ #define GRB_LOG_FAC GrbLogFacility::server
+
+ #include "grb_runtime.h" // API
++#include <cstring>
+
+ #include "config/config.h"
+ #include "config/config_definition.h"
+--- a/src/util/grb_net.cc
++++ b/src/util/grb_net.cc
+@@ -21,6 +21,7 @@
+ /// @file util/grb_net.cc
+ #define GRB_LOG_FAC GrbLogFacility::clients
+ #include "grb_net.h" // API
++#include <cstring>
+
+ #include "exceptions.h"
+ #include "logger.h"
+--- a/src/util/grb_fs.cc
++++ b/src/util/grb_fs.cc
+@@ -21,6 +21,7 @@
+ /// @file util/grb_fs.cc
+ #define GRB_LOG_FAC GrbLogFacility::content
+ #include "grb_fs.h" // API
++#include <cstring>
+
+ #include "exceptions.h"
+ #include "util/logger.h"
+--- a/src/config/setup/config_setup_path.cc
++++ b/src/config/setup/config_setup_path.cc
+@@ -25,6 +25,7 @@
+ #define GRB_LOG_FAC GrbLogFacility::config
+
+ #include "config_setup_path.h" // API
++#include <cstring>
+
+ #include "config/config_definition.h"
+ #include "config/config_options.h"
+--- a/src/util/thread_executor.cc
++++ b/src/util/thread_executor.cc
+@@ -32,6 +32,7 @@
+ /// @file util/thread_executor.cc
+
+ #include "thread_executor.h" // API
++#include <cstring>
+
+ #include "util/logger.h"
+
+--- a/src/util/thread_runner.h
++++ b/src/util/thread_runner.h
+@@ -28,6 +28,7 @@
+
+ #include "config/config.h"
+ #include "thread_executor.h"
++#include <cstring>
+ #include "util/logger.h"
+
+ #include <chrono>
+--- a/src/util/string_converter.cc
++++ b/src/util/string_converter.cc
+@@ -32,6 +32,7 @@
+ /// @file util/string_converter.cc
+ #define GRB_LOG_FAC GrbLogFacility::util
+ #include "string_converter.h" // API
++#include <cstring>
+
+ #include "common.h"
+ #include "config/config.h"
+--- a/src/content/inotify/mt_inotify.cc
++++ b/src/content/inotify/mt_inotify.cc
+@@ -41,6 +41,7 @@
+
+ #ifdef HAVE_INOTIFY
+ #include "mt_inotify.h"
++#include <cstring>
+
+ #include "exceptions.h"
+ #include "util/logger.h"
+--- a/src/metadata/metacontent_handler.cc
++++ b/src/metadata/metacontent_handler.cc
+@@ -25,6 +25,7 @@
+ #define GRB_LOG_FAC GrbLogFacility::metadata
+
+ #include "metacontent_handler.h" // API
++#include <cstring>
+
+ #include "cds/cds_item.h"
+ #include "cds/cds_objects.h"
+--- a/src/transcoding/transcode_ext_handler.cc
++++ b/src/transcoding/transcode_ext_handler.cc
+@@ -33,6 +33,7 @@
+ #define GRB_LOG_FAC GrbLogFacility::transcoding
+
+ #include "transcode_ext_handler.h" // API
++#include <cstring>
+
+ #include "cds/cds_objects.h"
+ #include "config/config.h"
+--- a/src/util/tools.cc
++++ b/src/util/tools.cc
+@@ -32,6 +32,7 @@
+ /// @file util/tools.cc
+ #define GRB_LOG_FAC GrbLogFacility::content
+ #include "tools.h" // API
++#include <cstring>
+
+ #include "config/config.h"
+ #include "contrib/md5.h"
+--- a/src/util/url_utils.cc
++++ b/src/util/url_utils.cc
+@@ -22,6 +22,7 @@
+ /// @file util/url_utils.cc
+ #define GRB_LOG_FAC GrbLogFacility::content
+ #include "url_utils.h" // API
++#include <cstring>
+
+ #include "exceptions.h"
+
+--
+2.43.0
diff --git a/meta-multimedia/recipes-multimedia/gerbera/gerbera_3.0.0.bb b/meta-multimedia/recipes-multimedia/gerbera/gerbera_3.0.0.bb
index fdbd91f9b0..a08c31d0c2 100644
--- a/meta-multimedia/recipes-multimedia/gerbera/gerbera_3.0.0.bb
+++ b/meta-multimedia/recipes-multimedia/gerbera/gerbera_3.0.0.bb
@@ -3,7 +3,10 @@ Description = "Gerbera is a UPnP media server which allows you to stream your di
 LICENSE = "GPL-2.0-only"
 LIC_FILES_CHKSUM = "file://LICENSE.md;md5=25cdec9afe3f1f26212ead6bd2f7fac8"

-SRC_URI = "git://github.com/gerbera/gerbera.git;protocol=https;branch=master;tag=v${PV}"
+SRC_URI = "git://github.com/gerbera/gerbera.git;protocol=https;branch=master;tag=v${PV} \
+           file://0001-fix-build-against-fmt-12-include-fmt-format.h.patch \
+           file://0002-include-cstring-for-std-strerror-std-memcpy.patch \
+           "
 SRCREV = "7846f3dd5d0f848a60d0c3146c3b7290881a8992"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.