diff mbox series

package/mpd: fix build with fmt 11

Message ID 20240712053614.733789-1-br015@umbiko.net
State Accepted
Headers show
Series package/mpd: fix build with fmt 11 | expand

Commit Message

Andreas Ziegler July 12, 2024, 5:35 a.m. UTC
Since commit 6b86f07 (package/fmt: bump to version 11.0.1), mpd fails to build:

/home/data/buildroot.x86_64/host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/fmt/base.h:1392:29: error: passing ‘const fmt::v11::formatter<std::__exception_ptr::exception_ptr>’ as ‘this’ argument discards qualifiers [-fpermissive]
 1392 |     ctx.advance_to(cf.format(*static_cast<qualified_type*>(arg), ctx));
      |                    ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../src/Log.cxx:5:
../src/lib/fmt/ExceptionFormatter.hxx:15:14: note:   in call to ‘auto fmt::v11::formatter<std::__exception_ptr::exception_ptr>::format(std::__exception_ptr::exception_ptr, FormatContext&) [with FormatContext = fmt::v11::context]’
   15 |         auto format(std::exception_ptr e, FormatContext &ctx) {
      |              ^~~~~~

Adapt an upstream change to restore mpd compatibility with fmt 11.  

Fixes: 
	http://autobuild.buildroot.net/results/73514ea76a5960f59b4c50e2074571b10e4682d4
	http://autobuild.buildroot.net/results/a58ddbdfe35bd19021e65db0b8b8cc4c1c884d51

Signed-off-by: Andreas Ziegler <br015@umbiko.net>
---
 ...fmt-support-build-with-libfmt-11.0.0.patch | 92 +++++++++++++++++++
 1 file changed, 92 insertions(+)
 create mode 100644 package/mpd/0002-lib-fmt-support-build-with-libfmt-11.0.0.patch

Comments

Thomas Petazzoni July 12, 2024, 6:47 a.m. UTC | #1
Hello Andreas,

On Fri, 12 Jul 2024 07:35:59 +0200
Andreas Ziegler <br015@umbiko.net> wrote:

> Since commit 6b86f07 (package/fmt: bump to version 11.0.1), mpd fails to build:
> 
> /home/data/buildroot.x86_64/host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/fmt/base.h:1392:29: error: passing ‘const fmt::v11::formatter<std::__exception_ptr::exception_ptr>’ as ‘this’ argument discards qualifiers [-fpermissive]
>  1392 |     ctx.advance_to(cf.format(*static_cast<qualified_type*>(arg), ctx));
>       |                    ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from ../src/Log.cxx:5:
> ../src/lib/fmt/ExceptionFormatter.hxx:15:14: note:   in call to ‘auto fmt::v11::formatter<std::__exception_ptr::exception_ptr>::format(std::__exception_ptr::exception_ptr, FormatContext&) [with FormatContext = fmt::v11::context]’
>    15 |         auto format(std::exception_ptr e, FormatContext &ctx) {
>       |              ^~~~~~
> 
> Adapt an upstream change to restore mpd compatibility with fmt 11.  
> 
> Fixes: 
> 	http://autobuild.buildroot.net/results/73514ea76a5960f59b4c50e2074571b10e4682d4
> 	http://autobuild.buildroot.net/results/a58ddbdfe35bd19021e65db0b8b8cc4c1c884d51
> 
> Signed-off-by: Andreas Ziegler <br015@umbiko.net>
> ---
>  ...fmt-support-build-with-libfmt-11.0.0.patch | 92 +++++++++++++++++++
>  1 file changed, 92 insertions(+)
>  create mode 100644 package/mpd/0002-lib-fmt-support-build-with-libfmt-11.0.0.patch

Thanks for the fix! Your patch had two small issues detected by "make
check-package":

WARNING: package/mpd/0002-lib-fmt-support-build-with-libfmt-11.0.0.patch:4: generate your patches with 'git format-patch -N'
WARNING: package/mpd/0002-lib-fmt-support-build-with-libfmt-11.0.0.patch:0: missing Upstream in the header (https://nightly.buildroot.org/#_additional_patch_documentation)

I fixed those two issues and applied. Thanks a lot!

Thomas
diff mbox series

Patch

diff --git a/package/mpd/0002-lib-fmt-support-build-with-libfmt-11.0.0.patch b/package/mpd/0002-lib-fmt-support-build-with-libfmt-11.0.0.patch
new file mode 100644
index 0000000000..99a03187d5
--- /dev/null
+++ b/package/mpd/0002-lib-fmt-support-build-with-libfmt-11.0.0.patch
@@ -0,0 +1,92 @@ 
+From 1402869715e3efca87942d79c3173a6b21a6925d Mon Sep 17 00:00:00 2001
+From: Rudi Heitbaum <rudi@heitbaum.com>
+Date: Fri, 5 Jul 2024 14:27:45 +0000
+Subject: [PATCH 1/1] lib/fmt: support build with libfmt-11.0.0
+
+Upstream libfmt commit fmtlib/fmt@d707292
+now requires the format function to be const.
+
+Adjust the function prototype so it is const and can compile.
+
+Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
+
+Context: https://github.com/MusicPlayerDaemon/MPD/issues/2071
+Pull request: https://github.com/MusicPlayerDaemon/MPD/pull/2069
+
+Fixes: http://autobuild.buildroot.net/results/73514ea76a5960f59b4c50e2074571b10e4682d4
+Fixes: http://autobuild.buildroot.net/results/a58ddbdfe35bd19021e65db0b8b8cc4c1c884d51
+
+Rebase for mpd-0.23.15
+
+Signed-off-by: Andreas Ziegler <br015@umbiko.net>
+---
+ src/lib/ffmpeg/LibFmt.hxx            | 2 +-
+ src/lib/fmt/AudioFormatFormatter.hxx | 4 ++--
+ src/lib/fmt/ExceptionFormatter.hxx   | 2 +-
+ src/lib/fmt/PathFormatter.hxx        | 2 +-
+ 4 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/lib/ffmpeg/LibFmt.hxx b/src/lib/ffmpeg/LibFmt.hxx
+index aa068711f..dee83ed2d 100644
+--- a/src/lib/ffmpeg/LibFmt.hxx
++++ b/src/lib/ffmpeg/LibFmt.hxx
+@@ -29,7 +29,7 @@
+ struct fmt::formatter<AVSampleFormat> : formatter<string_view>
+ {
+ 	template<typename FormatContext>
+-	auto format(const AVSampleFormat format, FormatContext &ctx) {
++	auto format(const AVSampleFormat format, FormatContext &ctx) const {
+ 		const char *name = av_get_sample_fmt_name(format);
+ 		if (name == nullptr)
+ 			name = "?";
+diff --git a/src/lib/fmt/AudioFormatFormatter.hxx b/src/lib/fmt/AudioFormatFormatter.hxx
+index e0ffb6216..8da98efd4 100644
+--- a/src/lib/fmt/AudioFormatFormatter.hxx
++++ b/src/lib/fmt/AudioFormatFormatter.hxx
+@@ -39,7 +39,7 @@
+ struct fmt::formatter<SampleFormat> : formatter<string_view>
+ {
+ 	template<typename FormatContext>
+-	auto format(const SampleFormat format, FormatContext &ctx) {
++	auto format(const SampleFormat format, FormatContext &ctx) const {
+ 		return formatter<string_view>::format(sample_format_to_string(format),
+ 						      ctx);
+ 	}
+@@ -49,7 +49,7 @@
+ struct fmt::formatter<AudioFormat> : formatter<string_view>
+ {
+ 	template<typename FormatContext>
+-	auto format(const AudioFormat &af, FormatContext &ctx) {
++	auto format(const AudioFormat &af, FormatContext &ctx) const {
+ 		return formatter<string_view>::format(ToString(af).c_str(),
+ 						      ctx);
+ 	}
+diff --git a/src/lib/fmt/ExceptionFormatter.hxx b/src/lib/fmt/ExceptionFormatter.hxx
+index 3f342df67..f08b3bb22 100644
+--- a/src/lib/fmt/ExceptionFormatter.hxx
++++ b/src/lib/fmt/ExceptionFormatter.hxx
+@@ -38,7 +38,7 @@
+ struct fmt::formatter<std::exception_ptr> : formatter<string_view>
+ {
+ 	template<typename FormatContext>
+-	auto format(std::exception_ptr e, FormatContext &ctx) {
++	auto format(std::exception_ptr e, FormatContext &ctx) const {
+ 		return formatter<string_view>::format(GetFullMessage(e), ctx);
+ 	}
+ };
+diff --git a/src/lib/fmt/PathFormatter.hxx b/src/lib/fmt/PathFormatter.hxx
+index e5ae89dec..add06df81 100644
+--- a/src/lib/fmt/PathFormatter.hxx
++++ b/src/lib/fmt/PathFormatter.hxx
+@@ -29,7 +29,7 @@
+ struct fmt::formatter<Path> : formatter<string_view>
+ {
+ 	template<typename FormatContext>
+-	auto format(Path path, FormatContext &ctx) {
++	auto format(Path path, FormatContext &ctx) const {
+ 		return formatter<string_view>::format(path.ToUTF8(), ctx);
+ 	}
+ };
+-- 
+2.43.0
+