does not compile with libfmt 9
Waybar 0.9.13 with libfmt 9.0.0 Also referenced in https://github.com/Alexays/Waybar/issues/1613
In file included from /usr/include/fmt/format.h:48,
from ../Waybar-0.9.13/include/client.hpp:3,
from ../Waybar-0.9.13/src/client.cpp:1:
/usr/include/fmt/core.h: In instantiation of ‘constexpr fmt::v9::detail::value<Context> fmt::v9::detail::make_value(T&&) [with Context = fmt::v9::basic_format_context<fmt::v9::appender, char>; T = Glib::ustring&]’:
/usr/include/fmt/core.h:1753:29: required from ‘constexpr fmt::v9::detail::value<Context> fmt::v9::detail::make_arg(T&&) [with bool IS_PACKED = true; Context = fmt::v9::basic_format_context<fmt::v9::appender, char>; fmt::v9::detail::type <anonymous> = fmt::v9::detail::type::custom_type; T = Glib::ustring; typename std::enable_if<IS_PACKED, int>::type <anonymous> = 0]’
/usr/include/fmt/core.h:1877:77: required from ‘constexpr fmt::v9::format_arg_store<Context, Args>::format_arg_store(T&& ...) [with T = {Glib::ustring, Glib::ustring}; Context = fmt::v9::basic_format_context<fmt::v9::appender, char>; Args = {Glib::ustring, Glib::ustring}]’
/usr/include/fmt/core.h:1894:38: required from ‘constexpr fmt::v9::format_arg_store<Context, typename std::remove_cv<typename std::remove_reference<Args>::type>::type ...> fmt::v9::make_format_args(Args&& ...) [with Context = fmt::v9::basic_format_context<fmt::v9::appender, char>; Args = {Glib::ustring, Glib::ustring}]’
/usr/include/spdlog/logger.h:370:68: required from ‘void spdlog::logger::log_(spdlog::source_loc, spdlog::level::level_enum, spdlog::string_view_t, Args&& ...) [with Args = {Glib::ustring, Glib::ustring}; spdlog::string_view_t = fmt::v9::basic_string_view<char>]’
/usr/include/spdlog/logger.h:90:13: required from ‘void spdlog::logger::log(spdlog::source_loc, spdlog::level::level_enum, fmt::v9::format_string<T ...>, Args&& ...) [with Args = {Glib::ustring, Glib::ustring}; fmt::v9::format_string<T ...> = fmt::v9::basic_format_string<char, Glib::ustring, Glib::ustring>]’
/usr/include/spdlog/logger.h:96:12: required from ‘void spdlog::logger::log(spdlog::level::level_enum, fmt::v9::format_string<T ...>, Args&& ...) [with Args = {Glib::ustring, Glib::ustring}; fmt::v9::format_string<T ...> = fmt::v9::basic_format_string<char, Glib::ustring, Glib::ustring>]’
/usr/include/spdlog/logger.h:152:12: required from ‘void spdlog::logger::debug(fmt::v9::format_string<T ...>, Args&& ...) [with Args = {Glib::ustring, Glib::ustring}; fmt::v9::format_string<T ...> = fmt::v9::basic_format_string<char, Glib::ustring, Glib::ustring>]’
/usr/include/spdlog/spdlog.h:151:32: required from ‘void spdlog::debug(fmt::v9::format_string<T ...>, Args&& ...) [with Args = {Glib::ustring, Glib::ustring}; fmt::v9::format_string<T ...> = fmt::v9::basic_format_string<char, Glib::ustring, Glib::ustring>]’
../Waybar-0.9.13/src/client.cpp:129:16: required from here
/usr/include/fmt/core.h:1733: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
1733 | formattable,
| ^~~~~~~~~~~
/usr/include/fmt/core.h:1733:7: note: ‘formattable’ evaluates to false
ninja: build stopped: subcommand failed.
I am able to build from the master branch
The issue still exists
❯ ninja -C build
ninja: Entering directory `build'
[56/127] Compiling C++ object test/waybar_test.p/.._src_config.cpp.o
In file included from /usr/include/spdlog/fmt/fmt.h:27,
from /usr/include/spdlog/common.h:45,
from /usr/include/spdlog/spdlog.h:12,
from ../src/config.cpp:3:
In member function ‘constexpr void fmt::v9::detail::fill_t<Char>::operator=(fmt::v9::basic_string_view<Char>) [with Char = char]’,
inlined from ‘constexpr void fmt::v9::detail::specs_setter<Char>::on_fill(fmt::v9::basic_string_view<Char>) [with Char = char]’ at /usr/include/fmt/core.h:2210:17,
inlined from ‘constexpr const Char* fmt::v9::detail::parse_align(const Char*, const Char*, Handler&&) [with Char = char; Handler = specs_checker<dynamic_specs_handler<fmt::v9::basic_format_parse_context<char> > >&]’ at /usr/include/fmt/core.h:2385:24,
inlined from ‘constexpr const Char* fmt::v9::detail::parse_format_specs(const Char*, const Char*, SpecHandler&&) [with Char = char; SpecHandler = specs_checker<dynamic_specs_handler<fmt::v9::basic_format_parse_context<char> > >&]’ at /usr/include/fmt/core.h:2576:22,
inlined from ‘constexpr decltype (ctx.begin()) fmt::v9::formatter<T, Char, typename std::enable_if<(fmt::v9::detail::type_constant<T, Char>::value != fmt::v9::detail::type::custom_type), void>::type>::parse(ParseContext&) [with ParseContext = fmt::v9::basic_format_parse_context<char>; T = fmt::v9::basic_string_view<char>; Char = char]’ at /usr/include/fmt/core.h:3044:41:
/usr/include/fmt/core.h:2096:48: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
2096 | for (size_t i = 0; i < size; ++i) data_[i] = s[i];
| ~~~~~~~~~^~~~
/usr/include/fmt/core.h: In member function ‘constexpr decltype (ctx.begin()) fmt::v9::formatter<T, Char, typename std::enable_if<(fmt::v9::detail::type_constant<T, Char>::value != fmt::v9::detail::type::custom_type), void>::type>::parse(ParseContext&) [with ParseContext = fmt::v9::basic_format_parse_context<char>; T = fmt::v9::basic_string_view<char>; Char = char]’:
/usr/include/fmt/core.h:2089:8: note: at offset 4 into destination object ‘fmt::v9::detail::fill_t<char>::data_’ of size 4
2089 | Char data_[max_size] = {Char(' '), Char(0), Char(0), Char(0)};
| ^~~~~
[84/127] Compiling C++ object waybar.p/src_config.cpp.o
In file included from /usr/include/spdlog/fmt/fmt.h:27,
from /usr/include/spdlog/common.h:45,
from /usr/include/spdlog/spdlog.h:12,
from ../src/config.cpp:3:
In member function ‘constexpr void fmt::v9::detail::fill_t<Char>::operator=(fmt::v9::basic_string_view<Char>) [with Char = char]’,
inlined from ‘constexpr void fmt::v9::detail::specs_setter<Char>::on_fill(fmt::v9::basic_string_view<Char>) [with Char = char]’ at /usr/include/fmt/core.h:2210:17,
inlined from ‘constexpr const Char* fmt::v9::detail::parse_align(const Char*, const Char*, Handler&&) [with Char = char; Handler = specs_checker<dynamic_specs_handler<fmt::v9::basic_format_parse_context<char> > >&]’ at /usr/include/fmt/core.h:2385:24,
inlined from ‘constexpr const Char* fmt::v9::detail::parse_format_specs(const Char*, const Char*, SpecHandler&&) [with Char = char; SpecHandler = specs_checker<dynamic_specs_handler<fmt::v9::basic_format_parse_context<char> > >&]’ at /usr/include/fmt/core.h:2576:22,
inlined from ‘constexpr decltype (ctx.begin()) fmt::v9::formatter<T, Char, typename std::enable_if<(fmt::v9::detail::type_constant<T, Char>::value != fmt::v9::detail::type::custom_type), void>::type>::parse(ParseContext&) [with ParseContext = fmt::v9::basic_format_parse_context<char>; T = fmt::v9::basic_string_view<char>; Char = char]’ at /usr/include/fmt/core.h:3044:41:
/usr/include/fmt/core.h:2096:48: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
2096 | for (size_t i = 0; i < size; ++i) data_[i] = s[i];
| ~~~~~~~~~^~~~
/usr/include/fmt/core.h: In member function ‘constexpr decltype (ctx.begin()) fmt::v9::formatter<T, Char, typename std::enable_if<(fmt::v9::detail::type_constant<T, Char>::value != fmt::v9::detail::type::custom_type), void>::type>::parse(ParseContext&) [with ParseContext = fmt::v9::basic_format_parse_context<char>; T = fmt::v9::basic_string_view<char>; Char = char]’:
/usr/include/fmt/core.h:2089:8: note: at offset 4 into destination object ‘fmt::v9::detail::fill_t<char>::data_’ of size 4
2089 | Char data_[max_size] = {Char(' '), Char(0), Char(0), Char(0)};
| ^~~~~
[95/127] Compiling C++ object waybar.p/src_modules_sway_bar.cpp.o
In file included from /usr/include/fmt/format.h:48,
from /usr/include/fmt/ostream.h:20,
from ../include/util/json.hpp:3,
from ../include/modules/sway/bar.hpp:7,
from ../src/modules/sway/bar.cpp:1:
In member function ‘constexpr void fmt::v9::detail::fill_t<Char>::operator=(fmt::v9::basic_string_view<Char>) [with Char = char]’,
inlined from ‘constexpr void fmt::v9::detail::specs_setter<Char>::on_fill(fmt::v9::basic_string_view<Char>) [with Char = char]’ at /usr/include/fmt/core.h:2210:17,
inlined from ‘constexpr const Char* fmt::v9::detail::parse_align(const Char*, const Char*, Handler&&) [with Char = char; Handler = specs_checker<dynamic_specs_handler<fmt::v9::basic_format_parse_context<char> > >&]’ at /usr/include/fmt/core.h:2385:24,
inlined from ‘constexpr const Char* fmt::v9::detail::parse_format_specs(const Char*, const Char*, SpecHandler&&) [with Char = char; SpecHandler = specs_checker<dynamic_specs_handler<fmt::v9::basic_format_parse_context<char> > >&]’ at /usr/include/fmt/core.h:2576:22,
inlined from ‘constexpr decltype (ctx.begin()) fmt::v9::formatter<T, Char, typename std::enable_if<(fmt::v9::detail::type_constant<T, Char>::value != fmt::v9::detail::type::custom_type), void>::type>::parse(ParseContext&) [with ParseContext = fmt::v9::basic_format_parse_context<char>; T = fmt::v9::basic_string_view<char>; Char = char]’ at /usr/include/fmt/core.h:3044:41:
/usr/include/fmt/core.h:2096:48: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
2096 | for (size_t i = 0; i < size; ++i) data_[i] = s[i];
| ~~~~~~~~~^~~~
/usr/include/fmt/core.h: In member function ‘constexpr decltype (ctx.begin()) fmt::v9::formatter<T, Char, typename std::enable_if<(fmt::v9::detail::type_constant<T, Char>::value != fmt::v9::detail::type::custom_type), void>::type>::parse(ParseContext&) [with ParseContext = fmt::v9::basic_format_parse_context<char>; T = fmt::v9::basic_string_view<char>; Char = char]’:
/usr/include/fmt/core.h:2089:8: note: at offset 4 into destination object ‘fmt::v9::detail::fill_t<char>::data_’ of size 4
2089 | Char data_[max_size] = {Char(' '), Char(0), Char(0), Char(0)};
| ^~~~~
[116/127] Compiling C++ object waybar.p/src_modules_sni_item.cpp.o
In file included from /usr/include/spdlog/fmt/fmt.h:27,
from /usr/include/spdlog/common.h:45,
from /usr/include/spdlog/spdlog.h:12,
from ../src/modules/sni/item.cpp:6:
In member function ‘constexpr void fmt::v9::detail::fill_t<Char>::operator=(fmt::v9::basic_string_view<Char>) [with Char = char]’,
inlined from ‘constexpr void fmt::v9::detail::specs_setter<Char>::on_fill(fmt::v9::basic_string_view<Char>) [with Char = char]’ at /usr/include/fmt/core.h:2210:17,
inlined from ‘constexpr const Char* fmt::v9::detail::parse_align(const Char*, const Char*, Handler&&) [with Char = char; Handler = specs_checker<dynamic_specs_handler<fmt::v9::basic_format_parse_context<char> > >&]’ at /usr/include/fmt/core.h:2385:24,
inlined from ‘constexpr const Char* fmt::v9::detail::parse_format_specs(const Char*, const Char*, SpecHandler&&) [with Char = char; SpecHandler = specs_checker<dynamic_specs_handler<fmt::v9::basic_format_parse_context<char> > >&]’ at /usr/include/fmt/core.h:2576:22,
inlined from ‘constexpr decltype (ctx.begin()) fmt::v9::formatter<T, Char, typename std::enable_if<(fmt::v9::detail::type_constant<T, Char>::value != fmt::v9::detail::type::custom_type), void>::type>::parse(ParseContext&) [with ParseContext = fmt::v9::basic_format_parse_context<char>; T = fmt::v9::basic_string_view<char>; Char = char]’ at /usr/include/fmt/core.h:3044:41:
/usr/include/fmt/core.h:2096:48: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
2096 | for (size_t i = 0; i < size; ++i) data_[i] = s[i];
| ~~~~~~~~~^~~~
/usr/include/fmt/core.h: In member function ‘constexpr decltype (ctx.begin()) fmt::v9::formatter<T, Char, typename std::enable_if<(fmt::v9::detail::type_constant<T, Char>::value != fmt::v9::detail::type::custom_type), void>::type>::parse(ParseContext&) [with ParseContext = fmt::v9::basic_format_parse_context<char>; T = fmt::v9::basic_string_view<char>; Char = char]’:
/usr/include/fmt/core.h:2089:8: note: at offset 4 into destination object ‘fmt::v9::detail::fill_t<char>::data_’ of size 4
2089 | Char data_[max_size] = {Char(' '), Char(0), Char(0), Char(0)};
| ^~~~~
[123/127] Linking target test/waybar_test
FAILED: test/waybar_test
c++ -o test/waybar_test test/waybar_test.p/main.cpp.o test/waybar_test.p/SafeSignal.cpp.o test/waybar_test.p/config.cpp.o test/waybar_test.p/.._src_config.cpp.o test/waybar_test.p/waybar_time.cpp.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -Wl,--start-group -lstdc++fs /usr/lib/libfmt.so /usr/lib/libgtkmm-3.0.so /usr/lib/libatkmm-1.6.so /usr/lib/libgdkmm-3.0.so /usr/lib/libgiomm-2.4.so /usr/lib/libgtk-3.so /usr/lib/libgdk-3.so /usr/lib/libz.so /usr/lib/libatk-1.0.so /usr/lib/libcairo-gobject.so /usr/lib/libgio-2.0.so /usr/lib/libpangomm-1.4.so /usr/lib/libglibmm-2.4.so /usr/lib/libcairomm-1.0.so /usr/lib/libsigc-2.0.so /usr/lib/libpangocairo-1.0.so /usr/lib/libpango-1.0.so /usr/lib/libharfbuzz.so /usr/lib/libcairo.so /usr/lib/libgdk_pixbuf-2.0.so /usr/lib/libgobject-2.0.so /usr/lib/libglib-2.0.so /usr/lib/libjsoncpp.so /usr/lib/libspdlog.so -pthread /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/libdate-tz.so -Wl,--end-group
/usr/sbin/ld: warning: libfmt.so.8, needed by /usr/lib/libspdlog.so, not found (try using -rpath or -rpath-link)
/usr/sbin/ld: test/waybar_test.p/.._src_config.cpp.o: in function `waybar::Config::mergeConfig(Json::Value&, Json::Value&)':
config.cpp:(.text+0x4311): undefined reference to `spdlog::details::log_msg::log_msg(spdlog::source_loc, fmt::v9::basic_string_view<char>, spdlog::level::level_enum, fmt::v9::basic_string_view<char>)'
/usr/sbin/ld: config.cpp:(.text+0x44ee): undefined reference to `spdlog::details::log_msg::log_msg(spdlog::source_loc, fmt::v9::basic_string_view<char>, spdlog::level::level_enum, fmt::v9::basic_string_view<char>)'
/usr/sbin/ld: test/waybar_test.p/.._src_config.cpp.o: in function `waybar::Config::resolveConfigIncludes(Json::Value&, int)':
config.cpp:(.text+0x4f56): undefined reference to `spdlog::details::log_msg::log_msg(spdlog::source_loc, fmt::v9::basic_string_view<char>, spdlog::level::level_enum, fmt::v9::basic_string_view<char>)'
/usr/sbin/ld: config.cpp:(.text+0x52d5): undefined reference to `spdlog::details::log_msg::log_msg(spdlog::source_loc, fmt::v9::basic_string_view<char>, spdlog::level::level_enum, fmt::v9::basic_string_view<char>)'
/usr/sbin/ld: test/waybar_test.p/.._src_config.cpp.o: in function `waybar::Config::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
config.cpp:(.text+0x57f2): undefined reference to `spdlog::details::log_msg::log_msg(spdlog::source_loc, fmt::v9::basic_string_view<char>, spdlog::level::level_enum, fmt::v9::basic_string_view<char>)'
/usr/sbin/ld: /usr/lib/libspdlog.so: undefined reference to `fmt::v8::detail::dragonbox::decimal_fp<float> fmt::v8::detail::dragonbox::to_decimal<float>(float)'
/usr/sbin/ld: /usr/lib/libspdlog.so: undefined reference to `int fmt::v8::detail::snprintf_float<double>(double, int, fmt::v8::detail::float_specs, fmt::v8::detail::buffer<char>&)'
/usr/sbin/ld: /usr/lib/libspdlog.so: undefined reference to `fmt::v8::detail::dragonbox::decimal_fp<double> fmt::v8::detail::dragonbox::to_decimal<double>(double)'
/usr/sbin/ld: /usr/lib/libspdlog.so: undefined reference to `char fmt::v8::detail::decimal_point_impl<char>(fmt::v8::detail::locale_ref)'
/usr/sbin/ld: /usr/lib/libspdlog.so: undefined reference to `int fmt::v8::detail::format_float<long double>(long double, int, fmt::v8::detail::float_specs, fmt::v8::detail::buffer<char>&)'
/usr/sbin/ld: /usr/lib/libspdlog.so: undefined reference to `int fmt::v8::detail::format_float<double>(double, int, fmt::v8::detail::float_specs, fmt::v8::detail::buffer<char>&)'
/usr/sbin/ld: /usr/lib/libspdlog.so: undefined reference to `fmt::v8::detail::throw_format_error(char const*)'
/usr/sbin/ld: /usr/lib/libspdlog.so: undefined reference to `int fmt::v8::detail::snprintf_float<long double>(long double, int, fmt::v8::detail::float_specs, fmt::v8::detail::buffer<char>&)'
/usr/sbin/ld: /usr/lib/libspdlog.so: undefined reference to `fmt::v8::detail::thousands_sep_result<char> fmt::v8::detail::thousands_sep_impl<char>(fmt::v8::detail::locale_ref)'
/usr/sbin/ld: /usr/lib/libspdlog.so: undefined reference to `fmt::v8::detail::assert_fail(char const*, int, char const*)'
/usr/sbin/ld: /usr/lib/libspdlog.so: undefined reference to `fmt::v8::detail::error_handler::on_error(char const*)'
/usr/sbin/ld: /usr/lib/libspdlog.so: undefined reference to `fmt::v8::format_system_error(fmt::v8::detail::buffer<char>&, int, char const*)'
/usr/sbin/ld: /usr/lib/libspdlog.so: undefined reference to `fmt::v8::vformat[abi:cxx11](fmt::v8::basic_string_view<char>, fmt::v8::basic_format_args<fmt::v8::basic_format_context<fmt::v8::appender, char> >)'
collect2: error: ld returned 1 exit status
[126/127] Compiling C++ object waybar.p/src_client.cpp.o
In file included from /usr/include/fmt/format.h:48,
from ../include/client.hpp:3,
from ../src/client.cpp:1:
In member function ‘constexpr void fmt::v9::detail::fill_t<Char>::operator=(fmt::v9::basic_string_view<Char>) [with Char = char]’,
inlined from ‘constexpr void fmt::v9::detail::specs_setter<Char>::on_fill(fmt::v9::basic_string_view<Char>) [with Char = char]’ at /usr/include/fmt/core.h:2210:17,
inlined from ‘constexpr const Char* fmt::v9::detail::parse_align(const Char*, const Char*, Handler&&) [with Char = char; Handler = specs_checker<dynamic_specs_handler<fmt::v9::basic_format_parse_context<char> > >&]’ at /usr/include/fmt/core.h:2385:24,
inlined from ‘constexpr const Char* fmt::v9::detail::parse_format_specs(const Char*, const Char*, SpecHandler&&) [with Char = char; SpecHandler = specs_checker<dynamic_specs_handler<fmt::v9::basic_format_parse_context<char> > >&]’ at /usr/include/fmt/core.h:2576:22,
inlined from ‘constexpr decltype (ctx.begin()) fmt::v9::formatter<T, Char, typename std::enable_if<(fmt::v9::detail::type_constant<T, Char>::value != fmt::v9::detail::type::custom_type), void>::type>::parse(ParseContext&) [with ParseContext = fmt::v9::basic_format_parse_context<char>; T = fmt::v9::basic_string_view<char>; Char = char]’ at /usr/include/fmt/core.h:3044:41:
/usr/include/fmt/core.h:2096:48: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
2096 | for (size_t i = 0; i < size; ++i) data_[i] = s[i];
| ~~~~~~~~~^~~~
/usr/include/fmt/core.h: In member function ‘constexpr decltype (ctx.begin()) fmt::v9::formatter<T, Char, typename std::enable_if<(fmt::v9::detail::type_constant<T, Char>::value != fmt::v9::detail::type::custom_type), void>::type>::parse(ParseContext&) [with ParseContext = fmt::v9::basic_format_parse_context<char>; T = fmt::v9::basic_string_view<char>; Char = char]’:
/usr/include/fmt/core.h:2089:8: note: at offset 4 into destination object ‘fmt::v9::detail::fill_t<char>::data_’ of size 4
2089 | Char data_[max_size] = {Char(' '), Char(0), Char(0), Char(0)};
| ^~~~~
ninja: build stopped: subcommand failed.
OS : Arch Linux libfmt provided by fmt v 9.1.0-1
@AlfredEVOL Which spdlog version do you use?
The error message below [123/127] said /usr/sbin/ld: warning: libfmt.so.8, needed by /usr/lib/libspdlog.so, not found (try using -rpath or -rpath-link)
It should use libfmt.so.9.
Can you paste the result of pacman -Qi spdlog?
❯ pacman -Qi spdlog
Name : spdlog
Version : 1.10.0-3.1
Description : Very fast, header-only/compiled, C++ logging library
Architecture : x86_64
URL : https://github.com/gabime/spdlog
Licenses : MIT
Groups : None
Provides : libspdlog.so=1-64
Depends On : libfmt.so=8-64
Optional Deps : None
Required By : mangohud waybar
Optional For : None
Conflicts With : None
Replaces : None
Installed Size : 727.12 KiB
Packager : ALHP x86-64-v3 <[email protected]>
Build Date : Thu 01 Sep 2022 07:00:35 PM IST
Install Date : Thu 01 Sep 2022 09:37:43 PM IST
Install Reason : Installed as a dependency for another package
Install Script : No
Validated By : Signature
The latest version of spdlog is depend on libfmt9.
https://archlinux.org/packages/community/x86_64/spdlog/
Please update your package.
Fixed, thanks
In my case too, the dependency on libfmt9 was not specified in the package.
I'm not very familiar with the build process, but would it be possible to check for the required package versions in the ninja build file, and have the build throw an explicit error when libfmt9 is absent? This would help package maintainers and users identify the dependency.