Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.9.21: build fails #2403

Closed
kloczek opened this issue Aug 14, 2023 · 9 comments · Fixed by #2409
Closed

0.9.21: build fails #2403

kloczek opened this issue Aug 14, 2023 · 9 comments · Fixed by #2409

Comments

@kloczek
Copy link

kloczek commented Aug 14, 2023

gcc 13.2 and build fails with

/usr/bin/g++ -Iwaybar.p -I. -I.. -I../include -Iprotocol -I/usr/include/sigc++-2.0 -I/usr/lib64/sigc++-2.0/include -I/usr/include/gtkmm-3.0 -I/usr/lib64/gtkmm-3.0/include -I/usr/include/atkmm-1.6 -I/usr/lib64/atkmm-1.6/include -I/usr/include/gtk-3.0/unix-print -I/usr/include/gdkmm-3.0 -I/usr/lib64/gdkmm-3.0/include -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/giomm-2.4 -I/usr/lib64/giomm-2.4/include -I/usr/include/pangomm-1.4 -I/usr/lib64/pangomm-1.4/include -I/usr/include/glibmm-2.4 -I/usr/lib64/glibmm-2.4/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/cairomm-1.0 -I/usr/lib64/cairomm-1.0/include -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/fribidi -I/usr/include/gio-unix-2.0 -I/usr/include/libnl3 -I/usr/include/libupower-glib -I/usr/include/playerctl -I/usr/include/wireplumber-0.4 -I/usr/include/libevdev-1.0 -I/usr/include/gtk-layer-shell -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++20 '-DVERSION="0.9.21"' -DHAVE_LANGINFO_1STDAY '-DSYSCONFDIR="//etc"' -DHAVE_CPU_LINUX -DHAVE_MEMORY_LINUX -DHAVE_SWAY -DHAVE_WLR -DHAVE_RIVER -DHAVE_DWL -DHAVE_HYPRLAND -DHAVE_LIBNL -DHAVE_GAMEMODE -DHAVE_UPOWER -DHAVE_MPRIS -DHAVE_LIBPULSE -DHAVE_LIBWIREPLUMBER -DHAVE_LIBUDEV -DHAVE_LIBEVDEV -DHAVE_LIBINPUT -DHAVE_LIBMPDCLIENT -DHAVE_GTK_LAYER_SHELL -DHAVE_GIO_UNIX -DWANT_RFKILL -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Os -pthread -D_REENTRANT -DSPDLOG_SHARED_LIB -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -MD -MQ waybar.p/src_client.cpp.o -MF waybar.p/src_client.cpp.o.d -o waybar.p/src_client.cpp.o -c ../src/client.cpp
In file included from ../src/client.cpp:9:
../include/util/format.hpp: In instantiation of ‘auto fmt::v10::formatter<Glib::ustring>::format(const Glib::ustring&, FormatContext&) [with FormatContext = fmt::v10::basic_format_context<fmt::v10::appender, char>]’:
/usr/include/fmt/core.h:1097:70:   required by substitution of ‘template<class Context, class T> constexpr decltype ((typename Context::formatter_type<T>().format(declval<const T&>(), declval<Context&>()), true)) fmt::v10::detail::has_const_formatter_impl(T*) [with Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; T = Glib::ustring]’
/usr/include/fmt/core.h:1108:43:   required from ‘constexpr bool fmt::v10::detail::has_const_formatter() [with T = Glib::ustring; Context = fmt::v10::basic_format_context<fmt::v10::appender, char>]’
/usr/include/fmt/core.h:1444:69:   required from ‘struct fmt::v10::detail::arg_mapper<fmt::v10::basic_format_context<fmt::v10::appender, char> >::formattable<const Glib::ustring, Glib::ustring>’
/usr/include/fmt/core.h:1452:25:   required by substitution of ‘template<class T, typename std::enable_if<(! fmt::v10::detail::arg_mapper<fmt::v10::basic_format_context<fmt::v10::appender, char> >::formattable<T, typename std::remove_const<_Tp>::type>::value), int>::type <anonymous> > constexpr fmt::v10::detail::unformattable fmt::v10::detail::arg_mapper<fmt::v10::basic_format_context<fmt::v10::appender, char> >::do_map(T&) [with T = const Glib::ustring; typename std::enable_if<(! fmt::v10::detail::arg_mapper<fmt::v10::basic_format_context<fmt::v10::appender, char> >::formattable<T, typename std::remove_const<_Tp>::type>::value), int>::type <anonymous> = <missing>]’
/usr/include/fmt/core.h:1463:69:   required by substitution of ‘template<class T, class U, typename std::enable_if<((((((std::is_class<U>::value || std::is_enum<_Tp2>::value) || std::is_union<U>::value) && (! fmt::v10::detail::is_string<U>::value)) && (! fmt::v10::is_char<U>::value)) && (! fmt::v10::detail::is_named_arg<T>::value)) && (! std::is_arithmetic<typename fmt::v10::detail::format_as_result<U>::type>::value)), int>::type <anonymous> > constexpr decltype (((fmt::v10::detail::arg_mapper<fmt::v10::basic_format_context<fmt::v10::appender, char> >*)this)->fmt::v10::detail::arg_mapper<fmt::v10::basic_format_context<fmt::v10::appender, char> >::do_map(val)) fmt::v10::detail::arg_mapper<fmt::v10::basic_format_context<fmt::v10::appender, char> >::map(T&) [with T = const Glib::ustring; U = Glib::ustring; typename std::enable_if<((((((std::is_class<U>::value || std::is_enum<_Tp2>::value) || std::is_union<U>::value) && (! fmt::v10::detail::is_string<U>::value)) && (! fmt::v10::is_char<U>::value)) && (! fmt::v10::detail::is_named_arg<T>::value)) && (! std::is_arithmetic<typename fmt::v10::detail::format_as_result<U>::type>::value)), int>::type <anonymous> = 0]’
/usr/include/fmt/core.h:1479:53:   required by substitution of ‘template<class T, class Context> using fmt::v10::detail::mapped_type_constant = fmt::v10::detail::type_constant<decltype (fmt::v10::detail::arg_mapper<Context>().map(declval<const T&>())), typename Context::char_type> [with T = Glib::ustring; Context = fmt::v10::basic_format_context<fmt::v10::appender, char>]’
/usr/include/fmt/core.h:2611:66:   required from ‘constexpr fmt::v10::detail::format_string_checker<Char, Args>::format_string_checker(fmt::v10::basic_string_view<Char>) [with Char = char; Args = {Glib::ustring, Glib::ustring}]’
../src/client.cpp:129:16:   required from here
../src/client.cpp:129:16:   in ‘constexpr’ expansion of ‘fmt::v10::basic_format_string<char, Glib::ustring, Glib::ustring>("Output removed: {} {}")’
../include/util/format.hpp:96:42: error: no matching function for call to ‘fmt::v10::formatter<Glib::ustring>::format(const Glib::ustring&, fmt::v10::basic_format_context<fmt::v10::appender, char>&)’
   96 |     return formatter<std::string>::format(value, ctx);
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
In file included from /usr/include/fmt/format.h:49,
                 from ../include/client.hpp:3,
                 from ../src/client.cpp:1:
/usr/include/fmt/core.h:2714:22: note: candidate: ‘template<class FormatContext> constexpr decltype (ctx.out()) fmt::v10::formatter<T, Char, typename std::enable_if<(fmt::v10::detail::type_constant<T, Char>::value != fmt::v10::detail::type::custom_type), void>::type>::format(const T&, FormatContext&) const [with T = fmt::v10::basic_string_view<char>; Char = char]’
 2714 |   FMT_CONSTEXPR auto format(const T& val, FormatContext& ctx) const
      |                      ^~~~~~
/usr/include/fmt/core.h:2714:22: note:   template argument deduction/substitution failed:
../include/util/format.hpp:96:42: note:   cannot convert ‘value’ (type ‘const Glib::ustring’) to type ‘const fmt::v10::basic_string_view<char>&’
   96 |     return formatter<std::string>::format(value, ctx);
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
ninja: build stopped: subcommand failed.
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /usr/bin/ninja -C /home/tkloczko/rpmbuild/BUILD/Waybar-0.9.21/x86_64-redhat-linux-gnu -j 1 -v
@kescherCode
Copy link

Might be related to the installed fmt version. Is that currently 10?

@jpalus
Copy link
Contributor

jpalus commented Aug 15, 2023

It fails with latest fmt 10.1.0, fmt 10.0.0 is fine. Bisected it down to de8d017:

de8d0171a298222b3150603347ea3fa0fee5b3a8 is the first bad commit
commit de8d0171a298222b3150603347ea3fa0fee5b3a8
Author: Victor Zverovich <viz@fb.com>
Date:   Sat May 20 18:28:01 2023 -0700

    Simplify FMT_FORMAT_AS

 include/fmt/core.h | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

@vitaut any idea if this is fmt regression or whether waybar is missing something?

@fakeowl1 your problem has nothing to do with this issue.

@vitaut
Copy link

vitaut commented Aug 15, 2023

The problem is likely due to an implicit conversion. Although it wasn't documented, previously one could define a formatter that inherited from a standard formatter and not provide a format function, relying on an implicit conversion instead. The fix is to add a format function that "forwards" to the one in the base class or use format_as.

jpalus added a commit to jpalus/Waybar that referenced this issue Aug 15, 2023
don't rely on implicit conversion which is no longer present in fmt
10.1.0

Fixes Alexays#2403
@kloczek
Copy link
Author

kloczek commented Aug 16, 2023

In my case above fail was with fmt 10.1.0.

@kloczek
Copy link
Author

kloczek commented Aug 16, 2023

Just tested with two patches added after 0.9.21 (57544fe and c823743) and build still fails with

[tkloczko@pers-jacek x86_64-redhat-linux-gnu]$ ninja -k 0
[1/2] Compiling C++ object waybar.p/src_modules_simpleclock.cpp.o
FAILED: waybar.p/src_modules_simpleclock.cpp.o
/usr/bin/g++ -Iwaybar.p -I. -I.. -I../include -Iprotocol -I/usr/include/sigc++-2.0 -I/usr/lib64/sigc++-2.0/include -I/usr/include/gtkmm-3.0 -I/usr/lib64/gtkmm-3.0/include -I/usr/include/atkmm-1.6 -I/usr/lib64/atkmm-1.6/include -I/usr/include/gtk-3.0/unix-print -I/usr/include/gdkmm-3.0 -I/usr/lib64/gdkmm-3.0/include -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/giomm-2.4 -I/usr/lib64/giomm-2.4/include -I/usr/include/pangomm-1.4 -I/usr/lib64/pangomm-1.4/include -I/usr/include/glibmm-2.4 -I/usr/lib64/glibmm-2.4/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/cairomm-1.0 -I/usr/lib64/cairomm-1.0/include -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/fribidi -I/usr/include/gio-unix-2.0 -I/usr/include/libnl3 -I/usr/include/libupower-glib -I/usr/include/playerctl -I/usr/include/wireplumber-0.4 -I/usr/include/libevdev-1.0 -I/usr/include/gtk-layer-shell -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++20 '-DVERSION="0.9.21"' -DHAVE_LANGINFO_1STDAY '-DSYSCONFDIR="//etc"' -DHAVE_CPU_LINUX -DHAVE_MEMORY_LINUX -DHAVE_SWAY -DHAVE_WLR -DHAVE_RIVER -DHAVE_DWL -DHAVE_HYPRLAND -DHAVE_LIBNL -DHAVE_GAMEMODE -DHAVE_UPOWER -DHAVE_MPRIS -DHAVE_LIBPULSE -DHAVE_LIBWIREPLUMBER -DHAVE_LIBUDEV -DHAVE_LIBEVDEV -DHAVE_LIBINPUT -DHAVE_LIBMPDCLIENT -DHAVE_GTK_LAYER_SHELL -DHAVE_GIO_UNIX -DWANT_RFKILL -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Os -pthread -D_REENTRANT -DSPDLOG_SHARED_LIB -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -MD -MQ waybar.p/src_modules_simpleclock.cpp.o -MF waybar.p/src_modules_simpleclock.cpp.o.d -o waybar.p/src_modules_simpleclock.cpp.o -c ../src/modules/simpleclock.cpp
../src/modules/simpleclock.cpp: In member function ‘virtual void waybar::modules::Clock::update()’:
../src/modules/simpleclock.cpp:21:26: error: ‘this’ is not a constant expression
   21 |   auto text = fmt::format(format_, localtime);
      |               ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
../src/modules/simpleclock.cpp:27:38:   in ‘constexpr’ expansion of ‘fmt::v10::basic_format_string<char, tm&>(tooltip_format)’
/usr/include/fmt/core.h:2731:62:   in ‘constexpr’ expansion of ‘((fmt::v10::basic_format_string<char, tm&>*)this)->fmt::v10::basic_format_string<char, tm&>::str_.fmt::v10::basic_string_view<char>::basic_string_view<std::char_traits<char>, std::allocator<char> >((* & s))’
/usr/include/fmt/core.h:432:21:   in ‘constexpr’ expansion of ‘(& s)->std::__cxx11::basic_string<char>::data()’
/usr/include/c++/13/bits/basic_string.h:2597:23:   in ‘constexpr’ expansion of ‘((const std::__cxx11::basic_string<char>*)this)->std::__cxx11::basic_string<char>::_M_data()’
../src/modules/simpleclock.cpp:27:38: error: the value of ‘tooltip_format’ is not usable in a constant expression
   27 |       auto tooltip_text = fmt::format(tooltip_format, localtime);
      |                           ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/modules/simpleclock.cpp:26:12: note: ‘tooltip_format’ was not declared ‘constexpr’
   26 |       auto tooltip_format = config_["tooltip-format"].asString();
      |            ^~~~~~~~~~~~~~
ninja: build stopped: cannot make progress due to previous errors.

@jpalus
Copy link
Contributor

jpalus commented Aug 16, 2023

Builds fine for me but I have date (tz_dep) and hence simpleclock.cpp is not being compiled:

Waybar/meson.build

Lines 334 to 342 in 5b33a59

if have_chrono_timezones
add_project_arguments('-DHAVE_CHRONO_TIMEZONES', language: 'cpp')
src_files += 'src/modules/clock.cpp'
elif tz_dep.found()
add_project_arguments('-DHAVE_LIBDATE', language: 'cpp')
src_files += 'src/modules/clock.cpp'
else
src_files += 'src/modules/simpleclock.cpp'
endif

@kloczek
Copy link
Author

kloczek commented Aug 16, 2023

Builds fine for me but I have date (tz_dep) and hence simpleclock.cpp is not being compiled:

Hmm .. so what I can try to do to diagnose this? 🤔
(I'm using gcc 13.2)

@jpalus
Copy link
Contributor

jpalus commented Aug 16, 2023

@kloczek can you check if waybar builds fine for you with #2412?

@kloczek
Copy link
Author

kloczek commented Aug 16, 2023

Just tested and with that commit it builds.
Thank you 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants