rizsotto / Bear

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

build error: static assertion failed: Cannot format an argument #536

Closed abdelmaged closed 2 months ago

abdelmaged commented 11 months ago

I'm building on centos 7.9, gcc 9.2, installed deps using vcpkg (json: 3.11.2, grpc: 1.51.1, spdlog: 1.12.0, fmt: 10.0.0) got the following error:

[16/59] Building CXX object libmain/CMakeFiles/main_a.dir/source/ApplicationFromArgs.cc.o
FAILED: libmain/CMakeFiles/main_a.dir/source/ApplicationFromArgs.cc.o 
g++ -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -Ibuild/subprojects/Build/BearSource -Isource/libmain/include -Isource/libresult/include -Isource/libflags/include -isystem vcpkg/installed/x64-linux/include -fno-exceptions -DSPDLOG_NO_EXCEPTIONS -DGOOGLE_PROTOBUF_NO_RTTI -Wall -Wextra -O3 -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 source/libmain/source/ApplicationFromArgs.cc
In file included from vcpkg/installed/x64-linux/include/fmt/format.h:49,
                 from vcpkg/installed/x64-linux/include/fmt/ostream.h:20,
                 from source/libmain/source/ApplicationFromArgs.cc:22:
vcpkg/installed/x64-linux/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 = const flags::Arguments&]’:
vcpkg/installed/x64-linux/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 = const flags::Arguments&; typename std::enable_if<IS_PACKED, int>::type <anonymous> = 0]’
vcpkg/installed/x64-linux/include/fmt/core.h:1827:77:   required from ‘constexpr fmt::v10::format_arg_store<Context, Args>::format_arg_store(T&& ...) [with T = {const flags::Arguments&}; Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; Args = {flags::Arguments}]’
vcpkg/installed/x64-linux/include/spdlog/logger.h:381:5:   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::v10::basic_string_view<char>]’
vcpkg/installed/x64-linux/include/spdlog/logger.h:90:9:   required from ‘void spdlog::logger::log(spdlog::source_loc, spdlog::level::level_enum, fmt::v10::format_string<T ...>, Args&& ...) [with Args = {const flags::Arguments&}; fmt::v10::format_string<T ...> = fmt::v10::basic_format_string<char, const flags::Arguments&>]’
vcpkg/installed/x64-linux/include/spdlog/logger.h:96:9:   required from ‘void spdlog::logger::log(spdlog::level::level_enum, fmt::v10::format_string<T ...>, Args&& ...) [with Args = {const flags::Arguments&}; fmt::v10::format_string<T ...> = fmt::v10::basic_format_string<char, const flags::Arguments&>]’
vcpkg/installed/x64-linux/include/spdlog/logger.h:152:9:   [ skipping 3 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
gcc/include/c++/9.2.0/type_traits:2336:26:   required by substitution of ‘template<class _Fn, class ... _Args> static std::__result_of_success<decltype (declval<_Fn>()((declval<_Args>)()...)), std::__invoke_other> std::__result_of_other_impl::_S_test(int) [with _Fn = ps::ApplicationFromArgs::command(int, const char**, const char**) const::<lambda(const auto:7&)>&; _Args = {const flags::Arguments&}]’
gcc/include/c++/9.2.0/type_traits:2347:55:   required from ‘struct std::__result_of_impl<false, false, ps::ApplicationFromArgs::command(int, const char**, const char**) const::<lambda(const auto:7&)>&, const flags::Arguments&>’
gcc/include/c++/9.2.0/type_traits:2352:12:   required from ‘struct std::__invoke_result<ps::ApplicationFromArgs::command(int, const char**, const char**) const::<lambda(const auto:7&)>&, const flags::Arguments&>’
gcc/include/c++/9.2.0/type_traits:2365:12:   required from ‘class std::result_of<ps::ApplicationFromArgs::command(int, const char**, const char**) const::<lambda(const auto:7&)>&(const flags::Arguments&)>’
gcc/include/c++/9.2.0/bits/std_function.h:448:9:   required by substitution of ‘template<class _Functor, class, class> std::function<void(const flags::Arguments&)>::function(_Functor) [with _Functor = ps::ApplicationFromArgs::command(int, const char**, const char**) const::<lambda(const auto:7&)>; <template-parameter-1-2> = void; <template-parameter-1-3> = void]’
source/libmain/source/ApplicationFromArgs.cc:49:14:   required from here
vcpkg/installed/x64-linux/include/spdlog/logger.h:374:75:   in ‘constexpr’ expansion of ‘fmt::v10::make_format_args<>(args#0)’
vcpkg/installed/x64-linux/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,
      |       ^~~~~~~~~~~
[17/59] Building CXX object libmain/CMakeFiles/main_a.dir/source/SubcommandFromArgs.cc.o
rizsotto commented 2 months ago

The error is in the 3rd party library, I am not sure if I can address it from this project.