Skip to content

crimson/mgr: include <fmt/chrono.h> for formatting a chrono duration - #72575

Merged
tchaikov merged 1 commit into
ceph:mainfrom
tchaikov:wip-crimson-fmt-chrono
Oct 22, 2026
Merged

tchaikov merged 1 commit into
ceph:mainfrom
tchaikov:wip-crimson-fmt-chrono

Conversation

@tchaikov

@tchaikov tchaikov commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Client::retry_interval() logs a std::chrono::duration, and fmt only knows how to format it with <fmt/chrono.h>. client.cc used to get that header through common/ceph_time.h, until a76d2ca ("common/ ceph_time: move fmt formatters to ceph_time_fmt.h") dropped the include there. Since then the crimson build fails with:

  error: '...type_is_unformattable_for<std::chrono::duration<double>,
  char> _' has incomplete type

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

Client::retry_interval() logs a std::chrono::duration<double>, and fmt
only knows how to format it with <fmt/chrono.h>. client.cc used to get
that header through common/ceph_time.h, until a76d2ca ("common/
ceph_time: move fmt formatters to ceph_time_fmt.h") dropped the include
there. Since then the crimson build fails with:

  error: '...type_is_unformattable_for<std::chrono::duration<double>,
  char> _' has incomplete type

Signed-off-by: Kefu Chai <[email protected]>
@tchaikov
tchaikov requested a review from a team as a code owner October 12, 2026 01:54
@tchaikov

Copy link
Copy Markdown
Contributor Author

cc @MaxKellermann

@tchaikov

Copy link
Copy Markdown
Contributor Author

for the full error message:

cmake --build ~/dev/ceph/build --target crimson-osd
[1/5] Building CXX object src/crimson/CMakeFiles/crimson.dir/mgr/client.cc.o
FAILED: src/crimson/CMakeFiles/crimson.dir/mgr/client.cc.o 
/usr/bin/c++ -DBOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION -DBOOST_ASIO_NO_TS_EXECUTORS -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_PROCESS_USE_STD_FS -DFMT_SHARED -DHAVE_CONFIG_H -DSEASTAR_API_LEVEL=10 -DSEASTAR_DEBUG -DSEASTAR_DEBUG_PROMISE -DSEASTAR_DEBUG_SHARED_PTR -DSEASTAR_DEFAULT_ALLOCATOR -DSEASTAR_HAVE_URING -DSEASTAR_LOGGER_COMPILE_TIME_FMT -DSEASTAR_LOGGER_TYPE_STDOUT -DSEASTAR_P2581R1 -DSEASTAR_SCHEDULING_GROUPS_COUNT=16 -DSEASTAR_SHUFFLE_TASK_QUEUE -DSEASTAR_SSTRING -DSEASTAR_TYPE_ERASE_MORE -DWITH_CRIMSON=1 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE -D__CEPH__ -D__STDC_FORMAT_MACROS -D__linux__ -I/home/kefu/dev/ceph/build/src/include -I/home/kefu/dev/ceph/src -I/home/kefu/dev/ceph/src/dmclock/support/src -I/home/kefu/dev/ceph/src/seastar/include -I/home/kefu/dev/ceph/build/src/seastar/gen/include -I/home/kefu/dev/ceph/build/src/seastar/gen/src -isystem /home/kefu/dev/ceph/build/boost/src/Boost -isystem /home/kefu/dev/ceph/build/include -isystem /home/kefu/dev/ceph/src/xxHash -Og -g -std=c++23 -fPIC -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -Wall -fno-strict-aliasing -fsigned-char -Wtype-limits -Wignored-qualifiers -Wpointer-arith -Werror=format-security -Winit-self -Wno-unknown-pragmas -Wnon-virtual-dtor -Wno-ignored-qualifiers -ftemplate-depth-1024 -DBOOST_ALLOW_DEPRECATED_HEADERS -Wpessimizing-move -Wredundant-move -Wstrict-null-sentinel -Woverloaded-virtual -DCEPH_DEBUG_MUTEX -fstack-protector-strong -D_GLIBCXX_ASSERTIONS -fdiagnostics-color=auto -ftemplate-backtrace-limit=0 -Wno-maybe-uninitialized -Wno-error=unused-result -fstack-clash-protection -Wno-non-virtual-dtor -MD -MT src/crimson/CMakeFiles/crimson.dir/mgr/client.cc.o -MF src/crimson/CMakeFiles/crimson.dir/mgr/client.cc.o.d -o src/crimson/CMakeFiles/crimson.dir/mgr/client.cc.o -c /home/kefu/dev/ceph/src/crimson/mgr/client.cc
In file included from /usr/include/fmt/format.h:49,
                 from /home/kefu/dev/ceph/src/seastar/include/seastar/core/sstring.hh:39,
                 from /home/kefu/dev/ceph/src/seastar/include/seastar/core/scheduling.hh:28,
                 from /home/kefu/dev/ceph/src/seastar/include/seastar/core/task.hh:24,
                 from /home/kefu/dev/ceph/src/seastar/include/seastar/core/future.hh:35,
                 from /home/kefu/dev/ceph/src/seastar/include/seastar/core/timer.hh:24,
                 from /home/kefu/dev/ceph/src/crimson/mgr/client.h:6,
                 from /home/kefu/dev/ceph/src/crimson/mgr/client.cc:4:
/usr/include/fmt/core.h: In instantiation of ‘constexpr decltype (ctx.begin()) fmt::v10::detail::parse_format_specs(ParseContext&) [with T = std::chrono::duration<double>; ParseContext = compile_parse_context<char>; decltype (ctx.begin()) = const char*]’:
/usr/include/fmt/core.h:2639:51:   required from here
 2639 |     return id >= 0 && id < num_args ? parse_funcs_[id](context_) : begin;
      |                                       ~~~~~~~~~~~~^
/home/kefu/dev/ceph/src/crimson/mgr/client.cc:146:3:   in ‘constexpr’ expansion of ‘seastar::logger::format_info<crimson::mgr::Client&, const char* const&, std::chrono::duration<double, std::ratio<1, 1> >&>("{} {}: reconnecting in {} seconds", std::source_location::current(__builtin_source_location()))’
/home/kefu/dev/ceph/src/seastar/include/seastar/util/log.hh:101:15:   in ‘constexpr’ expansion of ‘((seastar::logger::format_info<crimson::mgr::Client&, const char* const&, std::chrono::duration<double, std::ratio<1, 1> >&>*)this)->seastar::logger::format_info<crimson::mgr::Client&, const char* const&, std::chrono::duration<double, std::ratio<1, 1> >&>::format.fmt::v10::basic_format_string<char, crimson::mgr::Client&, const char* const&, std::chrono::duration<double, std::ratio<1, 1> >&>::basic_format_string<char [34]>((* & format))’
/usr/include/fmt/core.h:2740:40:   in ‘constexpr’ expansion of ‘fmt::v10::detail::parse_format_string<true, char, format_string_checker<char, crimson::mgr::Client, const char*, std::chrono::duration<double, std::ratio<1, 1> > > >(((fmt::v10::basic_format_string<char, crimson::mgr::Client&, const char* const&, std::chrono::duration<double, std::ratio<1, 1> >&>*)this)->fmt::v10::basic_format_string<char, crimson::mgr::Client&, const char* const&, std::chrono::duration<double, std::ratio<1, 1> >&>::str_, fmt::v10::detail::format_string_checker<char, crimson::mgr::Client, const char*, std::chrono::duration<double, std::ratio<1, 1> > >(fmt::v10::basic_string_view<char>(((const char*)s))))’
/usr/include/fmt/core.h:2523:36:   in ‘constexpr’ expansion of ‘fmt::v10::detail::parse_replacement_field<char, format_string_checker<char, crimson::mgr::Client, const char*, std::chrono::duration<double, std::ratio<1, 1> > >&>(p, end, (* & handler))’
/usr/include/fmt/core.h:2457:33:   in ‘constexpr’ expansion of ‘(& handler)->fmt::v10::detail::format_string_checker<char, crimson::mgr::Client, const char*, std::chrono::duration<double, std::ratio<1, 1> > >::on_replacement_field((& handler)->fmt::v10::detail::format_string_checker<char, crimson::mgr::Client, const char*, std::chrono::duration<double, std::ratio<1, 1> > >::on_arg_id(), begin)’
/usr/include/fmt/core.h:2632:20:   in ‘constexpr’ expansion of ‘((fmt::v10::detail::format_string_checker<char, crimson::mgr::Client, const char*, std::chrono::duration<double, std::ratio<1, 1> > >*)this)->fmt::v10::detail::format_string_checker<char, crimson::mgr::Client, const char*, std::chrono::duration<double, std::ratio<1, 1> > >::on_format_specs(id, begin, begin)’
/usr/include/fmt/core.h:2548:45: error: ‘fmt::v10::detail::type_is_unformattable_for<std::chrono::duration<double>, char> _’ has incomplete type
 2548 |     type_is_unformattable_for<T, char_type> _;
      |                                             ^
/usr/include/fmt/core.h: In instantiation of ‘constexpr fmt::v10::detail::value<Context> fmt::v10::detail::make_arg(T&) [with bool PACKED = true; Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; T = std::chrono::duration<double>; typename std::enable_if<PACKED, int>::type <anonymous> = 0]’:
/usr/include/fmt/core.h:1808:51:   required from ‘constexpr fmt::v10::format_arg_store<Context, Args>::format_arg_store(T& ...) [with T = {crimson::mgr::Client, const char* const, std::chrono::duration<double, std::ratio<1, 1> >}; Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; Args = {crimson::mgr::Client, const char*, std::chrono::duration<double, std::ratio<1, 1> >}]’
 1808 |         data_{detail::make_arg<is_packed, Context>(args)...} {
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/include/fmt/core.h:1826:18:   required from ‘OutputIt fmt::v10::format_to(OutputIt, format_string<T ...>, T&& ...) [with OutputIt = seastar::internal::log_buf::inserter_iterator; T = {crimson::mgr::Client&, const char* const&, std::chrono::duration<double, std::ratio<1, 1> >&}; typename std::enable_if<detail::is_output_iterator<OutputIt, char>::value, int>::type <anonymous> = 0; format_string<T ...> = basic_format_string<char, crimson::mgr::Client&, const char* const&, std::chrono::duration<double, std::ratio<1, 1> >&>]’
 1826 |   return {args...};
      |                  ^
/home/kefu/dev/ceph/src/seastar/include/seastar/util/log.hh:263:42:   required from ‘void seastar::logger::log(seastar::log_level, format_info_t<Args ...>, Args&& ...) [with Args = {crimson::mgr::Client&, const char* const&, std::chrono::duration<double, std::ratio<1, 1> >&}; format_info_t<Args ...> = format_info<crimson::mgr::Client&, const char* const&, std::chrono::duration<double, std::ratio<1, 1> >&>]’
  263 |                     return fmt::format_to(it, fmt.format, std::forward<Args>(args)...);
      |                            ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kefu/dev/ceph/src/crimson/mgr/client.cc:146:3:   required from here
  110 |   LOCAL_LOGGER.log(level_, "{} {}: " MSG, dpp, FNAME , ##__VA_ARGS__)
      |                   ^
/usr/include/fmt/core.h:2816:52:   in ‘constexpr’ expansion of ‘fmt::v10::make_format_args<>(args#0, args#1, args#2)’
/usr/include/fmt/core.h:1576:63: error: ‘fmt::v10::detail::type_is_unformattable_for<std::chrono::duration<double>, char> _’ has incomplete type
 1576 |     type_is_unformattable_for<T, typename Context::char_type> _;
      |                                                               ^
/usr/include/fmt/core.h:1580: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
 1580 |       formattable,
      |       ^~~~~~~~~~~
/usr/include/fmt/core.h:1580:7: note: ‘formattable’ evaluates to false

i am building with

  • GCC 14.2.0
  • fmt 10.1.1
  • libstd++

@perezjosibm

perezjosibm commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor
PR=wip-perezjos-crimson-only-12-10-2026-PR72575
$ teuthology-suite -s crimson-rados -p 101 --force-priority -c $PR -f debug --filter seastore --suite-branch main --suite-repo https://github.com/ceph/ceph.git
2026-10-12 17:36:16,584.584 INFO:teuthology.suite.run:Test results viewable at 

https://pulpito-ng.ceph.com/jjperez-2026-10-12_17:32:02-crimson-rados-wip-perezjos-crimson-only-12-10-2026-PR72575-distro-debug-trial/

@perezjosibm perezjosibm moved this from QA in Progress to Tested in Crimson Oct 15, 2026
@tchaikov
tchaikov merged commit 775dd4e into ceph:main Oct 22, 2026
22 of 27 checks passed
@tchaikov
tchaikov deleted the wip-crimson-fmt-chrono branch October 22, 2026 01:08
@Matan-B Matan-B moved this from Tested to Merged (Main) in Crimson Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Merged (Main)

Development

Successfully merging this pull request may close these issues.

5 participants