rizsotto / Bear

Bear is a tool that generates a compilation database for clang tooling.
GNU General Public License v3.0
4.76k stars 312 forks source link

Build failure with fmt-9.0.0 #471

Closed thesamesam closed 2 years ago

thesamesam commented 2 years ago

Describe the bug bear-3.0.19 fails to build with the newly-released fmt-9.0.0.

Originally reported downstream in Gentoo.

Partial error output (full log: build.log):

[18/61] Building CXX object libmain/CMakeFiles/main_a.dir/source/ApplicationFromArgs.cc.o
FAILED: libmain/CMakeFiles/main_a.dir/source/ApplicationFromArgs.cc.o 
/usr/bin/x86_64-pc-linux-gnu-g++ -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -I/var/tmp/portage/dev-util/bear-3.0.19/work/Bear-3.0.19_build/subprojects/Build/BearSource -I/var/tmp/portage/dev-util/bear-3.0.19/work/Bear-3.0.19/source/libmain/include -I/var/tmp/portage/dev-util/bear-3.0.19/work/Bear-3.0.19/source/libresult/include -I/var/tmp/portage/dev-util/bear-3.0.19/work/Bear-3.0.19/source/libflags/include -pipe -march=native -fno-diagnostics-color -O2 -fno-exceptions -DSPDLOG_NO_EXCEPTIONS -DGOOGLE_PROTOBUF_NO_RTTI -Wall -Wextra -O2 -g -DNDEBUG -std=c++17 -MD -MT libmain/CMakeFiles/main_a.dir/source/ApplicationFromArgs.cc.o -MF libmain/CMakeFiles/main_a.dir/source/ApplicationFromArgs.cc.o.d -o libmain/CMakeFiles/main_a.dir/source/ApplicationFromArgs.cc.o -c /var/tmp/portage/dev-util/bear-3.0.19/work/Bear-3.0.19/source/libmain/source/ApplicationFromArgs.cc
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 /var/tmp/portage/dev-util/bear-3.0.19/work/Bear-3.0.19/source/libmain/source/ApplicationFromArgs.cc:22:
/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 = const flags::Arguments&]’:
/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>; type <anonymous> = fmt::v9::detail::type::custom_type; T = const flags::Arguments&; 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 = {const flags::Arguments&}; Context = fmt::v9::basic_format_context<fmt::v9::appender, char>; Args = {flags::Arguments}]’
/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 = basic_format_context<appender, char>; Args = {const flags::Arguments&}]’
/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 = {const flags::Arguments&}; 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 = {const flags::Arguments&}; fmt::v9::format_string<T ...> = fmt::v9::basic_format_string<char, const flags::Arguments&>]’
/usr/include/spdlog/logger.h:96:12:   [ skipping 5 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/include/g++-v12/type_traits:2576:55:   required from ‘struct std::__result_of_impl<false, false, ps::ApplicationFromArgs::command(int, const char**, const char**) const::<lambda(const auto:8&)>&, const flags::Arguments&>’
/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/include/g++-v12/bits/std_function.h:348:9:   recursively required by substitution of ‘template<class _Result, class _Ret> struct std::__is_invocable_impl<_Result, _Ret, true, std::__void_t<typename _CTp::type> > [with _Result = std::__invoke_result<ps::ApplicationFromArgs::command(int, const char**, const char**) const::<lambda(const auto:8&)>&, const flags::Arguments&>; _Ret = void]’
/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/include/g++-v12/bits/std_function.h:348:9:   required from ‘struct std::function<void(const flags::Arguments&)>::_Callable<ps::ApplicationFromArgs::command(int, const char**, const char**) const::<lambda(const auto:8&)>, ps::ApplicationFromArgs::command(int, const char**, const char**) const::<lambda(const auto:8&)>, std::__invoke_result<ps::ApplicationFromArgs::command(int, const char**, const char**) const::<lambda(const auto:8&)>&, const flags::Arguments&> >’
/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/include/g++-v12/bits/std_function.h:353:8:   required by substitution of ‘template<class _Res, class ... _ArgTypes> template<class _Cond, class _Tp> using _Requires = std::__enable_if_t<_Cond::value, _Tp> [with _Cond = std::function<void(const flags::Arguments&)>::_Callable<ps::ApplicationFromArgs::command(int, const char**, const char**) const::<lambda(const auto:8&)>, ps::ApplicationFromArgs::command(int, const char**, const char**) const::<lambda(const auto:8&)>, std::__invoke_result<ps::ApplicationFromArgs::command(int, const char**, const char**) const::<lambda(const auto:8&)>&, const flags::Arguments&> >; _Tp = void; _Res = void; _ArgTypes = {const flags::Arguments&}]’
/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/include/g++-v12/bits/std_function.h:434:9:   required by substitution of ‘template<class _Functor, class _Constraints> std::function<void(const flags::Arguments&)>::function(_Functor&&) [with _Functor = ps::ApplicationFromArgs::command(int, const char**, const char**) const::<lambda(const auto:8&)>; _Constraints = void]’
/var/tmp/portage/dev-util/bear-3.0.19/work/Bear-3.0.19/source/libmain/source/ApplicationFromArgs.cc:38:24:   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

To Reproduce Steps to reproduce the behavior:

  1. Upgrade fmt to 9.0.0 (from 8.1.1)
  2. Try to build bear-3.0.19
  3. Build fails

Expected behavior Build suceeds with new fmt-9.0.0.

Environment:

Additional context

musicinmybrain commented 2 years ago

This can be worked around by defining the preprocessor macro FMT_DEPRECATED_OSTREAM, but that will be removed in fmt 10.0.

See the fmt 9.0 release notes.

rizsotto commented 2 years ago

thanks, will fix it this week.

rizsotto commented 2 years ago

Latest master has this fixed. Will be released this week.