MusicPlayerDaemon / MPD

Music Player Daemon
https://www.musicpd.org/
GNU General Public License v2.0
2.18k stars 351 forks source link

fmtlib 10.0.0 API changed, breaking compilation #1810

Closed 0-wiz-0 closed 1 year ago

0-wiz-0 commented 1 year ago

Bug report

Describe the bug

After updating fmtlib from 9.1.0 to 10.0.0 on my system, 0.23.12 does not compile any longer:

FAILED: mpd.p/src_command_FileCommands.cxx.o 
c++ -Impd.p -I. -I.. -Isrc -I../src -I/scratch/audio/musicpd/work/.buildlink/include -I/usr/pkg/include -I/usr/pkg/include/ffmpeg5 -I/usr/include -I/usr/include/krb5 -I/usr/pkg/include/faad2 -I/usr/pkg/include/freetype2 -I/usr/pkg/include/libdrm -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=c++17 -ffast-math -ftree-vectorize -Wcast-qual -Wdouble-promotion -Wmissing-declarations -Wshadow -Wunused -Wvla -Wwrite-strings -Wno-stringop-overflow -fno-threadsafe-statics -fmerge-all-constants -Wcomma-subscript -Wextra-semi -Wmismatched-tags -Woverloaded-virtual -Wsign-promo -Wvolatile -Wvirtual-inheritance -Wno-non-virtual-dtor -Wsuggest-override -fvisibility=hidden -ffunction-sections -fdata-sections -D_GNU_SOURCE -O2 -g -fPIC -D_FORTIFY_SOURCE=2 -fstack-clash-protection -g -DPCRE2_CODE_UNIT_WIDTH=0 -DBOOST_ALL_NO_LIB -MD -MQ mpd.p/src_command_FileCommands.cxx.o -MF mpd.p/src_command_FileCommands.cxx.o.d -o mpd.p/src_command_FileCommands.cxx.o -c ../src/command/FileCommands.cxx
In file included from ../src/client/Response.hxx:25,
                 from ../src/command/FileCommands.cxx:25:
/scratch/audio/musicpd/work/.buildlink/include/fmt/core.h: In instantiation of 'constexpr fmt::v10::detail::value<Context> fmt::v10::detail::make_value(T&&) [with Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; T = StringView&]':
/scratch/audio/musicpd/work/.buildlink/include/fmt/core.h:1711:29:   required from 'constexpr fmt::v10::detail::value<Context> fmt::v10::detail::make_arg(T&&) [with bool IS_PACKED = true; Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; fmt::v10::detail::type <anonymous> = fmt::v10::detail::type::custom_type; T = StringView&; typename std::enable_if<IS_PACKED, int>::type <anonymous> = 0]'
/scratch/audio/musicpd/work/.buildlink/include/fmt/core.h:1827:77:   required from 'constexpr fmt::v10::format_arg_store<Context, Args>::format_arg_store(T&& ...) [with T = {StringView&, StringView&}; Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; Args = {StringView, StringView}]'
/scratch/audio/musicpd/work/.buildlink/include/fmt/core.h:1844:31:   required from 'constexpr fmt::v10::format_arg_store<Context, fmt::v10::remove_cvref_t<T>...> fmt::v10::make_format_args(T&& ...) [with Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; T = {StringView&, StringView&}]'
../src/client/Response.hxx:87:29:   required from 'bool Response::Fmt(const S&, Args&& ...) [with S = PrintCommentHandler::OnPair(StringView, StringView)::<lambda()>::FMT_COMPILE_STRING; Args = {StringView&, StringView&}]'
../src/command/FileCommands.cxx:135:51:   required from here
/scratch/audio/musicpd/work/.buildlink/include/fmt/core.h:1691:7: error: static assertion failed: Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt
 1691 |       formattable,
      |       ^~~~~~~~~~~
[468/563] Compiling C++ object mpd.p/src_command_QueueCommands.cxx.o
[469/563] Compiling C++ object mpd.p/src_command_PlayerCommands.cxx.o
FAILED: mpd.p/src_command_PlayerCommands.cxx.o 
c++ -Impd.p -I. -I.. -Isrc -I../src -I/scratch/audio/musicpd/work/.buildlink/include -I/usr/pkg/include -I/usr/pkg/include/ffmpeg5 -I/usr/include -I/usr/include/krb5 -I/usr/pkg/include/faad2 -I/usr/pkg/include/freetype2 -I/usr/pkg/include/libdrm -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=c++17 -ffast-math -ftree-vectorize -Wcast-qual -Wdouble-promotion -Wmissing-declarations -Wshadow -Wunused -Wvla -Wwrite-strings -Wno-stringop-overflow -fno-threadsafe-statics -fmerge-all-constants -Wcomma-subscript -Wextra-semi -Wmismatched-tags -Woverloaded-virtual -Wsign-promo -Wvolatile -Wvirtual-inheritance -Wno-non-virtual-dtor -Wsuggest-override -fvisibility=hidden -ffunction-sections -fdata-sections -D_GNU_SOURCE -O2 -g -fPIC -D_FORTIFY_SOURCE=2 -fstack-clash-protection -g -DPCRE2_CODE_UNIT_WIDTH=0 -DBOOST_ALL_NO_LIB -MD -MQ mpd.p/src_command_PlayerCommands.cxx.o -MF mpd.p/src_command_PlayerCommands.cxx.o.d -o mpd.p/src_command_PlayerCommands.cxx.o -c ../src/command/PlayerCommands.cxx
In file included from ../src/client/Response.hxx:25,
                 from ../src/command/PlayerCommands.cxx:27:
/scratch/audio/musicpd/work/.buildlink/include/fmt/core.h: In instantiation of 'constexpr fmt::v10::detail::value<Context> fmt::v10::detail::make_value(T&&) [with Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; T = StringBuffer<24>&]':
/scratch/audio/musicpd/work/.buildlink/include/fmt/core.h:1711:29:   required from 'constexpr fmt::v10::detail::value<Context> fmt::v10::detail::make_arg(T&&) [with bool IS_PACKED = true; Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; fmt::v10::detail::type <anonymous> = fmt::v10::detail::type::custom_type; T = StringBuffer<24>&; typename std::enable_if<IS_PACKED, int>::type <anonymous> = 0]'
/scratch/audio/musicpd/work/.buildlink/include/fmt/core.h:1827:77:   required from 'constexpr fmt::v10::format_arg_store<Context, Args>::format_arg_store(T&& ...) [with T = {StringBuffer<24>&}; Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; Args = {StringBuffer<24>}]'
/scratch/audio/musicpd/work/.buildlink/include/fmt/core.h:1844:31:   required from 'constexpr fmt::v10::format_arg_store<Context, fmt::v10::remove_cvref_t<T>...> fmt::v10::make_format_args(T&& ...) [with Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; T = {StringBuffer<24>&}]'
../src/client/Response.hxx:87:29:   required from 'bool Response::Fmt(const S&, Args&& ...) [with S = handle_status(Client&, Request, Response&)::<lambda()>::FMT_COMPILE_STRING; Args = {StringBuffer<24>}]'
../src/command/PlayerCommands.cxx:188:46:   required from here
/scratch/audio/musicpd/work/.buildlink/include/fmt/core.h:1691:7: error: static assertion failed: Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt
 1691 |       formattable,
      |       ^~~~~~~~~~~

Please let me know if you think this is a bug in fmtlib itself, then I can file the bug report there. Thanks!

Expected Behavior

Build succeeds.

Actual Behavior

See above

Version

(of the version compiled against 9.1.0)

Music Player Daemon 0.23.12 (0.23.12)
Copyright 2003-2007 Warren Dukes <warren.dukes@gmail.com>
Copyright 2008-2021 Max Kellermann <max.kellermann@gmail.com>
This is free software; see the source for copying conditions.  There is NO
warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Database plugins:
 simple

Storage plugins:
 local curl

Decoders plugins:
 [mpg123] mp3
 [vorbis] ogg oga
 [oggflac] ogg oga
 [flac] flac
 [opus] opus ogg oga
 [sndfile] wav aiff aif au snd paf iff svx sf voc w64 pvf xi htk caf sd2
 [dsdiff] dff
 [dsf] dsf
 [hybrid_dsd] m4a
 [faad] aac
 [mpcdec] mpc
 [wavpack] wv
 [mikmod] amf dsm far gdm imf it med mod mtm s3m stm stx ult uni xm
 [wildmidi] mid
 [ffmpeg] 16sv 3g2 3gp 4xm 8svx aa3 aac ac3 adx afc aif aifc aiff al alaw amr anim apc ape asf atrac au aud avi avm2 avs bap bfi c93 cak cin cmv cpk daud dct divx dts dv dvd dxa eac3 film flac flc fli fll flx flv g726 gsm gxf iss m1v m2v m2t m2ts m4a m4b m4v mad mj2 mjpeg mjpg mka mkv mlp mm mmf mov mp+ mp1 mp2 mp3 mp4 mpc mpeg mpg mpga mpp mpu mve mvi mxf nc nsv nut nuv oga ogm ogv ogx oma ogg omg opus psp pva qcp qt r3d ra ram rl2 rm rmvb roq rpl rvc shn smk snd sol son spx str swf tak tgi tgq tgv thp ts tsp tta xa xvid uv uv2 vb vid vob voc vp6 vmd wav webm wma wmv wsaud wsvga wv wve rtp:// rtsp:// rtsps://
 [pcm]

Filters:
 libsamplerate

Tag plugins:
 id3tag

Output plugins:
 shout null fifo pipe ao oss solaris httpd snapcast recorder

Encoder plugins:
 null vorbis opus wave flac

Input plugins:
 file curl ffmpeg

Playlist plugins:
 extm3u m3u pls xspf asx rss flac cue embcue

Protocols:
 file:// ftp:// ftps:// gopher:// hls+http:// hls+https:// http:// https:// mmsh:// mmst:// rtmp:// rtmps:// rtmpt:// rtmpts:// rtp:// rtsp:// rtsps:// smb:// srtp://

Other features:
 icu ipv6 tcp un

Configuration

not relevant, compile error

Log

not relevant, compile error

MaxKellermann commented 1 year ago

Duplicate of https://github.com/MusicPlayerDaemon/MPD/issues/1807 and has been fixed already in master

0-wiz-0 commented 1 year ago

Thank you. Do you have a patch for the second error (the one for StringView) or can you please make a new release?

0-wiz-0 commented 1 year ago

Ok, no patch needed, I sprinkled some std::string() constructors locally to make it compile.