mpd: fix build against fmt 12.2.0

Since fmt 12.2.0, <fmt/core.h> is a shim that only includes <fmt/base.h>,
which does not declare fmt::format(). Building mpd 0.24.9 against it
fails with:

  src/net/ToString.cxx:80:16: error: no member named 'format' in namespace 'fmt'
  src/lib/avahi/Publisher.cxx:37:9: error: no member named 'format' in namespace 'fmt'

Add a patch that includes <fmt/format.h> directly in the files that
call fmt::format(). This mirrors the upstream fix (MPD commits
88d5b5248d71 and 109c26258b9d), extended to the files present in the
0.24.9 release that call fmt::format() but were not covered by those
commits.

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Khem Raj
2026-07-09 17:27:55 +00:00
parent 1656c0abb5
commit 7b4333942b
2 changed files with 209 additions and 0 deletions
@@ -0,0 +1,208 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Khem Raj <khem.raj@oss.qualcomm.com>
Date: Wed, 8 Jul 2026 00:00:00 +0000
Subject: [PATCH] libfmt 12.2.0 support: use fmt/format.h not fmt/core.h
Since libfmt 12.2.0, <fmt/core.h> is a shim that only includes
<fmt/base.h>, which does not declare fmt::format(). Building against it
fails with:
src/net/ToString.cxx:80:16: error: no member named 'format' in namespace 'fmt'
src/lib/avahi/Publisher.cxx:37:9: error: no member named 'format' in namespace 'fmt'
Include <fmt/format.h> directly in the files that call fmt::format().
This mirrors the upstream fix (MPD commits 88d5b5248d71 and 109c26258b9d)
extended to the files present in this release that call fmt::format().
Upstream-Status: Backport [https://github.com/MusicPlayerDaemon/MPD/commit/88d5b5248d71]
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
--- a/src/client/New.cxx
+++ b/src/client/New.cxx
@@ -17,7 +17,7 @@
#include "Log.hxx"
#include "Version.h"
-#include <fmt/core.h>
+#include <fmt/format.h>
#include <cassert>
--- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
+++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
@@ -24,7 +24,7 @@
#include "util/StringSplit.hxx"
#include "config/Block.hxx"
-#include <fmt/core.h>
+#include <fmt/format.h>
#include <cassert>
#include <string>
--- a/src/db/update/Playlist.cxx
+++ b/src/db/update/Playlist.cxx
@@ -20,7 +20,7 @@
#include "fs/Traits.hxx"
#include "Log.hxx"
-#include <fmt/core.h>
+#include <fmt/format.h>
inline void
UpdateWalk::UpdatePlaylistFile(Directory &directory,
--- a/src/input/plugins/AlsaInputPlugin.cxx
+++ b/src/input/plugins/AlsaInputPlugin.cxx
@@ -27,7 +27,7 @@
#include <alsa/asoundlib.h>
-#include <fmt/core.h>
+#include <fmt/format.h>
#include <cassert>
--- a/src/input/plugins/QobuzClient.cxx
+++ b/src/input/plugins/QobuzClient.cxx
@@ -4,7 +4,7 @@
#include "QobuzClient.hxx"
#include "lib/crypto/MD5.hxx"
-#include <fmt/core.h>
+#include <fmt/format.h>
#include <cassert>
#include <stdexcept>
--- a/src/input/plugins/QobuzLoginRequest.cxx
+++ b/src/input/plugins/QobuzLoginRequest.cxx
@@ -6,7 +6,7 @@
#include "QobuzSession.hxx"
#include "lib/curl/Form.hxx"
-#include <fmt/core.h>
+#include <fmt/format.h>
#include <nlohmann/json.hpp>
#include <cassert>
--- a/src/input/plugins/QobuzTrackRequest.cxx
+++ b/src/input/plugins/QobuzTrackRequest.cxx
@@ -5,7 +5,7 @@
#include "QobuzErrorParser.hxx"
#include "QobuzClient.hxx"
-#include <fmt/core.h>
+#include <fmt/format.h>
#include <nlohmann/json.hpp>
using std::string_view_literals::operator""sv;
--- a/src/lib/avahi/Publisher.cxx
+++ b/src/lib/avahi/Publisher.cxx
@@ -13,7 +13,7 @@
#include <avahi-common/malloc.h>
#include <avahi-common/alternative.h>
-#include <fmt/core.h>
+#include <fmt/format.h>
#include <cassert>
--- a/src/lib/nfs/FileReader.cxx
+++ b/src/lib/nfs/FileReader.cxx
@@ -10,7 +10,7 @@
#include <nfsc/libnfs.h> // for struct nfs_stat_64
-#include <fmt/core.h>
+#include <fmt/format.h>
#include <cassert>
#include <cstring>
--- a/src/output/Init.cxx
+++ b/src/output/Init.cxx
@@ -24,7 +24,7 @@
#include "util/StringAPI.hxx"
#include "Log.hxx"
-#include <fmt/core.h>
+#include <fmt/format.h>
#include <cassert>
#include <stdexcept>
--- a/src/output/plugins/httpd/HttpdClient.cxx
+++ b/src/output/plugins/httpd/HttpdClient.cxx
@@ -13,7 +13,7 @@
#include "util/StringSplit.hxx"
#include "Log.hxx"
-#include <fmt/core.h>
+#include <fmt/format.h>
#include <cassert>
--- a/src/output/plugins/httpd/IcyMetaDataServer.cxx
+++ b/src/output/plugins/httpd/IcyMetaDataServer.cxx
@@ -5,7 +5,7 @@
#include "tag/Tag.hxx"
#include "util/TruncateString.hxx"
-#include <fmt/core.h>
+#include <fmt/format.h>
#include <iterator>
--- a/src/song/AddedSinceSongFilter.cxx
+++ b/src/song/AddedSinceSongFilter.cxx
@@ -6,7 +6,7 @@
#include "time/ISO8601.hxx"
#include "util/StringBuffer.hxx"
-#include <fmt/core.h>
+#include <fmt/format.h>
using std::string_view_literals::operator""sv;
--- a/src/song/AudioFormatSongFilter.cxx
+++ b/src/song/AudioFormatSongFilter.cxx
@@ -5,7 +5,7 @@
#include "LightSong.hxx"
#include "util/StringBuffer.hxx"
-#include <fmt/core.h>
+#include <fmt/format.h>
using std::string_view_literals::operator""sv;
--- a/src/song/ModifiedSinceSongFilter.cxx
+++ b/src/song/ModifiedSinceSongFilter.cxx
@@ -6,7 +6,7 @@
#include "time/ISO8601.hxx"
#include "util/StringBuffer.hxx"
-#include <fmt/core.h>
+#include <fmt/format.h>
using std::string_view_literals::operator""sv;
--- a/src/storage/plugins/NfsStorage.cxx
+++ b/src/storage/plugins/NfsStorage.cxx
@@ -28,7 +28,7 @@
#include <nfsc/libnfs-raw-nfs.h>
}
-#include <fmt/core.h>
+#include <fmt/format.h>
#include <cassert>
#include <string>
--- a/src/net/ToString.cxx
+++ b/src/net/ToString.cxx
@@ -6,7 +6,7 @@
#include "SocketAddress.hxx"
#include "IPv4Address.hxx"
-#include <fmt/core.h>
+#include <fmt/format.h>
#include <algorithm>
#include <cassert>
--
2.43.0
@@ -20,6 +20,7 @@ DEPENDS += " \
SRC_URI = "git://github.com/MusicPlayerDaemon/MPD;branch=master;protocol=https;tag=v${PV} \
file://mpd.conf.in \
file://0001-libfmt-12.2.0-support-use-fmt-format.h-not-fmt-core.h.patch \
"
SRCREV = "7a9afa059e95668c912f779219ee8fe1e44dd2aa"