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

Bear fails to build with fmt 10.1 #542

Closed inglor closed 10 months ago

inglor commented 10 months ago

Describe the bug Fail to build with fmt 10.1 releae

To Reproduce Steps to reproduce the behavior: Update fmt to 10.1 and build as per instuctions

Expected behavior Successfuly build bear

Environment:

Additional context

Before you send...

Build logs:

❯ cmake -DENABLE_UNIT_TESTS=OFF -DENABLE_FUNC_TESTS=OFF ../
-- The C compiler identification is AppleClang 14.0.3.14030022
-- The CXX compiler identification is AppleClang 14.0.3.14030022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Setting build type to 'Release' as none was specified.
-- Looking for nlohman_json dependency
-- Looking for nlohman_json dependency -- found
-- Looking for fmt dependency
-- Looking for fmt dependency -- found
-- Looking for spdlog dependency
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Looking for spdlog dependency -- found
-- Looking for gRPC::grpc++ dependency
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.2") 
-- Checking for modules 'protobuf>=3.11;grpc++>=1.26'
--   Found protobuf, version 23.4.0
--   Found grpc++, version 1.56.2
-- Looking for gRPC::grpc++ dependency -- found
-- Looking for protoc
-- Looking for protoc -- found
-- Looking for grpc_cpp_plugin
-- Looking for grpc_cpp_plugin -- found
-- Configuring done (2.3s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/inglor/workspace/junk/Bear/build
❯ make all
[  0%] Built target grpc_dependency
[  0%] Built target googletest_dependency
[  0%] Built target nlohmann_json_dependency
[  0%] Built target fmt_dependency
[  0%] Built target spdlog_dependency
[ 11%] Creating directories for 'BearSource'
[ 22%] No download step for 'BearSource'
[ 33%] No update step for 'BearSource'
[ 44%] No patch step for 'BearSource'
[ 55%] Performing configure step for 'BearSource'
loading initial cache file /Users/inglor/workspace/junk/Bear/build/subprojects/tmp/BearSource/BearSource-cache-Release.cmake
-- The C compiler identification is AppleClang 14.0.3.14030022
-- The CXX compiler identification is AppleClang 14.0.3.14030022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found nlohmann_json: /usr/local/share/cmake/nlohmann_json/nlohmann_jsonConfig.cmake (found version "3.11.2") 
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.2") 
-- Checking for modules 'protobuf;grpc++'
--   Found protobuf, version 23.4.0
--   Found grpc++, version 1.56.2
-- Looking for spawn.h
-- Looking for spawn.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for errno.h
-- Looking for errno.h - found
-- Looking for sys/utsname.h
-- Looking for sys/utsname.h - found
-- Looking for sys/wait.h
-- Looking for sys/wait.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for gnu/lib-names.h
-- Looking for gnu/lib-names.h - not found
-- Looking for _NSGetEnviron
-- Looking for _NSGetEnviron - found
-- Looking for dlopen
-- Looking for dlopen - found
-- Looking for dlsym
-- Looking for dlsym - found
-- Looking for dlerror
-- Looking for dlerror - found
-- Looking for dlclose
-- Looking for dlclose - found
-- Looking for RTLD_NEXT
-- Looking for RTLD_NEXT - found
-- Looking for EACCES
-- Looking for EACCES - found
-- Looking for ENOENT
-- Looking for ENOENT - found
-- Looking for strerror_r
-- Looking for strerror_r - found
-- Looking for environ
-- Looking for environ - not found
-- Looking for uname
-- Looking for uname - found
-- Looking for confstr
-- Looking for confstr - found
-- Looking for _CS_PATH
-- Looking for _CS_PATH - found
-- Looking for _CS_GNU_LIBC_VERSION
-- Looking for _CS_GNU_LIBC_VERSION - not found
-- Looking for _CS_GNU_LIBPTHREAD_VERSION
-- Looking for _CS_GNU_LIBPTHREAD_VERSION - not found
-- Looking for protoc ... /usr/local/bin/protoc
-- Looking for grpc_cpp_plugin ... /usr/local/bin/grpc_cpp_plugin
-- Configuring done (9.1s)
-- Generating done (0.2s)
-- Build files have been written to: /Users/inglor/workspace/junk/Bear/build/subprojects/Build/BearSource
[ 66%] Performing build step for 'BearSource'
[  1%] Building CXX object libflags/CMakeFiles/flags_a.dir/source/Flags.cc.o
[  1%] Built target flags_a
[  3%] Building CXX object libshell/CMakeFiles/shell_a.dir/source/Command.cc.o
[  3%] Built target shell_a
[  5%] Building CXX object libsys/CMakeFiles/sys_a.dir/source/Os.cc.o
[  6%] Building CXX object libsys/CMakeFiles/sys_a.dir/source/Guard.cc.o
[  8%] Building CXX object libsys/CMakeFiles/sys_a.dir/source/Errors.cc.o
[ 10%] Building CXX object libsys/CMakeFiles/sys_a.dir/source/Path.cc.o
[ 12%] Building CXX object libsys/CMakeFiles/sys_a.dir/source/Process.cc.o
In file included from /Users/inglor/workspace/junk/Bear/source/libsys/source/Process.cc:20:
/Users/inglor/workspace/junk/Bear/source/libsys/include/libsys/Process.h:108:20: warning: private field 'with_preload_' is not used [-Wunused-private-field]
        const bool with_preload_;
                   ^
1 warning generated.
[ 13%] Building CXX object libsys/CMakeFiles/sys_a.dir/source/Signal.cc.o
[ 13%] Built target sys_a
[ 15%] Building CXX object libmain/CMakeFiles/main_a.dir/source/ApplicationLogConfig.cc.o
[ 17%] Building CXX object libmain/CMakeFiles/main_a.dir/source/ApplicationFromArgs.cc.o
[ 18%] Building CXX object libmain/CMakeFiles/main_a.dir/source/SubcommandFromArgs.cc.o
[ 18%] Built target main_a
[ 20%] Generating supervise.pb.h, supervise.grpc.pb.h, supervise.pb.cc, supervise.grpc.pb.cc
[ 22%] Generating intercept.pb.h, intercept.grpc.pb.h, intercept.pb.cc, intercept.grpc.pb.cc
[ 24%] Building CXX object intercept/proto/CMakeFiles/rpc_a.dir/supervise.pb.cc.o
[ 25%] Building CXX object intercept/proto/CMakeFiles/rpc_a.dir/supervise.grpc.pb.cc.o
[ 27%] Building CXX object intercept/proto/CMakeFiles/rpc_a.dir/intercept.pb.cc.o
[ 29%] Building CXX object intercept/proto/CMakeFiles/rpc_a.dir/intercept.grpc.pb.cc.o
[ 29%] Built target rpc_a
[ 31%] Building CXX object intercept/CMakeFiles/domain_a.dir/source/Domain.cc.o
[ 32%] Building CXX object intercept/CMakeFiles/domain_a.dir/source/Convert.cc.o
[ 32%] Built target domain_a
[ 34%] Building CXX object intercept/CMakeFiles/events_db_a.dir/source/collect/db/EventsDatabaseReader.cc.o
[ 36%] Building CXX object intercept/CMakeFiles/events_db_a.dir/source/collect/db/EventsDatabaseWriter.cc.o
[ 36%] Built target events_db_a
[ 37%] Building CXX object intercept/CMakeFiles/exec_a.dir/source/report/libexec/Buffer.cc.o
[ 39%] Building CXX object intercept/CMakeFiles/exec_a.dir/source/report/libexec/Environment.cc.o
[ 41%] Building CXX object intercept/CMakeFiles/exec_a.dir/source/report/libexec/Executor.cc.o
[ 43%] Building CXX object intercept/CMakeFiles/exec_a.dir/source/report/libexec/Linker.cc.o
[ 44%] Building CXX object intercept/CMakeFiles/exec_a.dir/source/report/libexec/Logger.cc.o
[ 46%] Building CXX object intercept/CMakeFiles/exec_a.dir/source/report/libexec/Paths.cc.o
[ 48%] Building CXX object intercept/CMakeFiles/exec_a.dir/source/report/libexec/Resolver.cc.o
[ 50%] Building CXX object intercept/CMakeFiles/exec_a.dir/source/report/libexec/Session.cc.o
[ 50%] Built target exec_a
[ 51%] Building CXX object intercept/CMakeFiles/intercept_a.dir/source/collect/Intercept.cc.o
[ 53%] Building CXX object intercept/CMakeFiles/intercept_a.dir/source/collect/Reporter.cc.o
[ 55%] Building CXX object intercept/CMakeFiles/intercept_a.dir/source/collect/RpcServices.cc.o
[ 56%] Building CXX object intercept/CMakeFiles/intercept_a.dir/source/collect/Session.cc.o
[ 58%] Building CXX object intercept/CMakeFiles/intercept_a.dir/source/collect/SessionWrapper.cc.o
[ 58%] Built target intercept_a
[ 60%] Building CXX object intercept/CMakeFiles/wrapper_a.dir/source/report/wrapper/EventFactory.cc.o
[ 62%] Building CXX object intercept/CMakeFiles/wrapper_a.dir/source/report/wrapper/EventReporter.cc.o
[ 63%] Building CXX object intercept/CMakeFiles/wrapper_a.dir/source/report/wrapper/RpcClients.cc.o
[ 65%] Building CXX object intercept/CMakeFiles/wrapper_a.dir/source/report/wrapper/Application.cc.o
[ 65%] Built target wrapper_a
[ 67%] Building CXX object intercept/CMakeFiles/wrapper.dir/source/report/wrapper/main.cc.o
[ 68%] Linking CXX executable wrapper
[ 68%] Built target wrapper
[ 70%] Building CXX object intercept/CMakeFiles/exec.dir/source/report/libexec/lib.cc.o
[ 72%] Building CXX object intercept/CMakeFiles/exec.dir/source/report/libexec/std.cc.o
[ 74%] Linking CXX shared library libexec.dylib
[ 74%] Built target exec
[ 75%] Building CXX object citnames/CMakeFiles/citnames_json_a.dir/source/Configuration.cc.o
[ 77%] Building CXX object citnames/CMakeFiles/citnames_json_a.dir/source/Output.cc.o
[ 77%] Built target citnames_json_a
[ 79%] Building CXX object citnames/CMakeFiles/citnames_a.dir/source/Citnames.cc.o
[ 81%] Building CXX object citnames/CMakeFiles/citnames_a.dir/source/semantic/Build.cc.o
[ 82%] Building CXX object citnames/CMakeFiles/citnames_a.dir/source/semantic/Parsers.cc.o
[ 84%] Building CXX object citnames/CMakeFiles/citnames_a.dir/source/semantic/Semantic.cc.o
In file included from /Users/inglor/workspace/junk/Bear/source/citnames/source/semantic/Semantic.cc:22:
/usr/local/include/fmt/format.h:4235:30: error: no matching member function for call to 'format'
      out = value_formatter_.format(*it, ctx);
            ~~~~~~~~~~~~~~~~~^~~~~~
/usr/local/include/fmt/core.h:1308:22: note: in instantiation of function template specialization 'fmt::formatter<fmt::join_view<std::__wrap_iter<const std::filesystem::path *>, std::__wrap_iter<const std::filesystem::path *>>>::format<fmt::basic_format_context<fmt::appender, char>>' requested here
    ctx.advance_to(f.format(*static_cast<qualified_type*>(arg), ctx));
                     ^
/usr/local/include/fmt/core.h:1291:21: note: in instantiation of function template specialization 'fmt::detail::value<fmt::basic_format_context<fmt::appender, char>>::format_custom_arg<fmt::join_view<std::__wrap_iter<const std::filesystem::path *>, std::__wrap_iter<const std::filesystem::path *>>, fmt::formatter<fmt::join_view<std::__wrap_iter<const std::filesystem::path *>, std::__wrap_iter<const std::filesystem::path *>>>>' requested here
    custom.format = format_custom_arg<
                    ^
/usr/local/include/fmt/core.h:1584:10: note: in instantiation of function template specialization 'fmt::detail::value<fmt::basic_format_context<fmt::appender, char>>::value<fmt::join_view<std::__wrap_iter<const std::filesystem::path *>, std::__wrap_iter<const std::filesystem::path *>>>' requested here
  return {arg_mapper<Context>().map(val)};
         ^
/Users/inglor/workspace/junk/Bear/source/citnames/source/semantic/Semantic.cc:94:38: note: in instantiation of function template specialization 'fmt::format<fmt::join_view<std::__wrap_iter<const std::filesystem::path *>, std::__wrap_iter<const std::filesystem::path *>>>' requested here
            << ", sources: " << fmt::format("[{}]", fmt::join(sources.begin(), sources.end(), ", "))
                                     ^
/usr/local/include/fmt/core.h:2714:22: note: candidate function template not viable: no known conversion from 'const std::filesystem::path' to 'const fmt::basic_string_view<char>' for 1st argument
  FMT_CONSTEXPR auto format(const T& val, FormatContext& ctx) const
                     ^
In file included from /Users/inglor/workspace/junk/Bear/source/citnames/source/semantic/Semantic.cc:22:
/usr/local/include/fmt/format.h:4240:32: error: no matching member function for call to 'format'
        out = value_formatter_.format(*it, ctx);
              ~~~~~~~~~~~~~~~~~^~~~~~
/usr/local/include/fmt/core.h:2714:22: note: candidate function template not viable: no known conversion from 'const std::filesystem::path' to 'const fmt::basic_string_view<char>' for 1st argument
  FMT_CONSTEXPR auto format(const T& val, FormatContext& ctx) const
                     ^
2 errors generated.
make[5]: *** [citnames/CMakeFiles/citnames_a.dir/source/semantic/Semantic.cc.o] Error 1
make[4]: *** [citnames/CMakeFiles/citnames_a.dir/all] Error 2
make[3]: *** [all] Error 2
make[2]: *** [subprojects/Stamp/BearSource/BearSource-build] Error 2
make[1]: *** [CMakeFiles/BearSource.dir/all] Error 2
make: *** [all] Error 2
Saur2000 commented 10 months ago

If it is of any help, commit de8d0171a298222b3150603347ea3fa0fee5b3a8 (Simplify FMT_FORMAT_AS) in fmt is the cause of the problem. However, I have no idea if this is something that should be fixed in fmt or bear.

rizsotto commented 10 months ago

@inglor , could you verify the fix on master is fixing the issue for you?

inglor commented 10 months ago

@inglor , could you verify the fix on master is fixing the issue for you?

it does - thanks!

rizsotto commented 10 months ago

Will make a new release on the weekend.

inglor commented 10 months ago

Will make a new release on the weekend.

That would be great! Looking forward to it.