You are not logged in.

#1 2025-11-23 20:16:32

talowicz
Member
Registered: 2024-08-13
Posts: 20

[SOLVED] C++ libfmt compile time error

I am trying to compile this: https://github.com/sandialabs/gr-pdu_utils

I am trying to compile on Arch Linux with these relevant package version numbers:
    GNU Make 4.4.1
    cpp (gcc)  v15.2.1
    extra/boost 1.89.0-3
    extra/boost-libs 1.89.0-3
    fmt v9.9

The repo successfully builds in a fresh Ubuntu 22.04 VM with these relevant package version numbers:
    GNU Make 4.3
    cpp (gcc) v11.4.0-1ubuntu1~22.04.2
    libboost-* v1.74.0-14ubuntu3
    fmt v8.32

This is the error I am getting:

[  1%] Building CXX object lib/CMakeFiles/gnuradio-pdu_utils.dir/pdu_set_m_impl.cc.o
In file included from /usr/include/fmt/format.h:41,
                 from /usr/include/spdlog/fmt/fmt.h:25,
                 from /usr/include/gnuradio/io_signature.h:19,
                 from /usr/include/gnuradio/basic_block.h:15,
                 from /usr/include/gnuradio/block.h:17,
                 from /home/user/media/repos/fhss/gr-pdu_utils/lib/../include/gnuradio/pdu_utils/pdu_set_m.h:13,
                 from /home/user/media/repos/fhss/gr-pdu_utils/lib/pdu_set_m_impl.h:14,
                 from /home/user/media/repos/fhss/gr-pdu_utils/lib/pdu_set_m_impl.cc:14:
/usr/include/fmt/base.h: In instantiation of ‘static void fmt::v12::detail::value<Context>::format_custom(void*, fmt::v12::parse_context<typename Context::char_type>&, Context&) [with T = boost::basic_format<char>; Context = fmt::v12::context; typename Context::char_type = char]’:
/usr/include/fmt/base.h:2303:19:   required from ‘constexpr fmt::v12::detail::value<Context>::value(T&, fmt::v12::detail::custom_tag) [with T = const boost::basic_format<char>; typename std::enable_if<has_formatter<T, typename Context::char_type>(), int>::type <anonymous> = 0; Context = fmt::v12::context]’
 2303 |     custom.format = format_custom<value_type>;
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/fmt/base.h:2283:65:   required from ‘fmt::v12::detail::value<Context>::value(T&) [with T = const boost::basic_format<char>; typename std::enable_if<(std::integral_constant<bool, (((((((std::is_class<T>::value || std::is_enum<T>::value) || std::is_union<T>::value) || std::is_array<_Up>::value) && (! fmt::v12::detail::has_to_string_view<T, void>::value)) && (! fmt::v12::detail::is_named_arg<T>::value)) && (! fmt::v12::detail::use_format_as<T>::value)) && (! fmt::v12::detail::use_format_as_member<typename std::remove_const<T>::type, std::integral_constant<bool, true> >::value))>::value || (!1)), int>::type <anonymous> = 0; Context = fmt::v12::context]’
 2283 |   FMT_CONSTEXPR20 FMT_INLINE value(T& x) : value(x, custom_tag()) {}
      |                                                                 ^
/usr/include/fmt/base.h:2828:20:   required from ‘constexpr fmt::v12::detail::format_arg_store<Context, NUM_ARGS, NUM_NAMED_ARGS, DESC> fmt::v12::make_format_args(T& ...) [with Context = context; T = {const boost::basic_format<char, std::char_traits<char>, std::allocator<char> >}; int NUM_ARGS = 1; int NUM_NAMED_ARGS = 0; long long unsigned int DESC = 15]’
 2828 |   return {{args...}};
      |                    ^
/usr/include/spdlog/logger.h:328:75:   required from ‘void spdlog::logger::log_(spdlog::source_loc, spdlog::level::level_enum, spdlog::string_view_t, Args&& ...) [with Args = {const boost::basic_format<char, std::char_traits<char>, std::allocator<char> >&}; spdlog::string_view_t = fmt::v12::basic_string_view<char>]’
  328 | t::vformat_to(fmt::appender(buf), fmt, fmt::make_format_args(args...));
      |                                        ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
/usr/include/spdlog/logger.h:80:13:   required from ‘void spdlog::logger::log(spdlog::source_loc, spdlog::level::level_enum, fmt::v12::format_string<T ...>, Args&& ...) [with Args = {const boost::basic_format<char, std::char_traits<char>, std::allocator<char> >&}; fmt::v12::format_string<T ...> = fmt::v12::fstring<const boost::basic_format<char, std::char_traits<char>, std::allocator<char> >&>]’
   80 |         log_(loc, lvl, details::to_string_view(fmt), std::forward<Args>(args)...);
      |         ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/spdlog/logger.h:98:12:   required from ‘void spdlog::logger::log(spdlog::source_loc, spdlog::level::level_enum, const T&) [with T = boost::basic_format<char>; typename std::enable_if<(! spdlog::is_convertible_to_any_format_string<const T&>::value), int>::type <anonymous> = 0]’
   98 |         log(loc, lvl, "{}", msg);
      |         ~~~^~~~~~~~~~~~~~~~~~~~~
/usr/include/spdlog/logger.h:90:12:   required from ‘void spdlog::logger::log(spdlog::level::level_enum, const T&) [with T = boost::basic_format<char>]’
   90 |         log(source_loc{}, lvl, msg);
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/spdlog/logger.h:243:12:   required from ‘void spdlog::logger::info(const T&) [with T = boost::basic_format<char>]’
  243 |         log(level::info, msg);
      |         ~~~^~~~~~~~~~~~~~~~~~
/home/user/media/repos/fhss/gr-pdu_utils/lib/pdu_set_m_impl.cc:74:13:   required from here
   74 |             GR_LOG_NOTICE(d_logger, boost::format("value is %1%") % val());
      |             ^
/usr/include/fmt/base.h:2323:29: error: passing ‘const fmt::v12::formatter<boost::basic_format<char> >’ as ‘this’ argument discards qualifiers [-fpermissive]
 2323 |     ctx.advance_to(cf.format(*static_cast<qualified_type*>(arg), ctx));
      |                    ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/gnuradio/custom_lock.h:15,
                 from /usr/include/gnuradio/buffer.h:15,
                 from /usr/include/gnuradio/buffer_double_mapped.h:15,
                 from /usr/include/gnuradio/io_signature.h:29:
/usr/include/gnuradio/logger.h:323:10: note:   in call to ‘decltype (((fmt::v12::formatter<boost::basic_format<char> >*)this)->fmt::v12::detail::native_formatter<fmt::v12::basic_string_view<char>, char, fmt::v12::detail::type::string_type>::format(bfmt.boost::basic_format<char>::str(), ctx)) fmt::v12::formatter<boost::basic_format<char> >::format(const boost::format&, FormatContext&) [with FormatContext = fmt::v12::context; decltype (((fmt::v12::formatter<boost::basic_format<char> >*)this)->fmt::v12::detail::native_formatter<fmt::v12::basic_string_view<char>, char, fmt::v12::detail::type::string_type>::format(bfmt.boost::basic_format<char>::str(), ctx)) = fmt::v12::basic_appender<char>; boost::format = boost::basic_format<char>]’
  323 |     auto format(const boost::format& bfmt, FormatContext& ctx)
      |          ^~~~~~
make[2]: *** [lib/CMakeFiles/gnuradio-pdu_utils.dir/build.make:93: lib/CMakeFiles/gnuradio-pdu_utils.dir/pdu_set_m_impl.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:282: lib/CMakeFiles/gnuradio-pdu_utils.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

From my limited knowledge of C++ I can decipher that this issue is atleast related to libfmt or boost. Wondering if anyone has the same issue and where to proceed from there - Should I post an issue on the github?

Thanks smile

Last edited by talowicz (2025-11-24 18:48:52)

Offline

#2 2025-11-23 21:01:44

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,519

Re: [SOLVED] C++ libfmt compile time error

/usr/include/gnuradio/logger.h:323:10: note:   in call to ‘decltype (((fmt::v12::formatter<boost::basic_format<char> >*)this)->fmt::v12::detail::native_formatter<fmt::v12::basic_string_view<char>, char, fmt::v12::detail::type::string_type>::format(bfmt.boost::basic_format<char>::str(), ctx)) fmt::v12::formatter<boost::basic_format<char> >::format(const boost::format&, FormatContext&) [with FormatContext = fmt::v12::context; decltype (((fmt::v12::formatter<boost::basic_format<char> >*)this)->fmt::v12::detail::native_formatter<fmt::v12::basic_string_view<char>, char, fmt::v12::detail::type::string_type>::format(bfmt.boost::basic_format<char>::str(), ctx)) = fmt::v12::basic_appender<char>; boost::format = boost::basic_format<char>]’
  323 |     auto format(const boost::format& bfmt, FormatContext& ctx)

That function needs to be

auto format(const boost::format& bfmt, FormatContext& ctx) const

https://github.com/gnuradio/gnuradio/bl … ger.h#L323
Still exists in the 3.11git tag, but  seems gone in https://github.com/gnuradio/gnuradio/bl … o/logger.h so I've no idea what the upstream plans itr are.

=> https://aur.archlinux.org/packages/gnuradio-git ?

Edit: or since it's an inline function you can also just edit the local header in place.

Last edited by seth (2025-11-23 21:21:33)

Offline

#3 2025-11-24 04:51:33

talowicz
Member
Registered: 2024-08-13
Posts: 20

Re: [SOLVED] C++ libfmt compile time error

seth wrote:
/usr/include/gnuradio/logger.h:323:10: note:   in call to ‘decltype (((fmt::v12::formatter<boost::basic_format<char> >*)this)->fmt::v12::detail::native_formatter<fmt::v12::basic_string_view<char>, char, fmt::v12::detail::type::string_type>::format(bfmt.boost::basic_format<char>::str(), ctx)) fmt::v12::formatter<boost::basic_format<char> >::format(const boost::format&, FormatContext&) [with FormatContext = fmt::v12::context; decltype (((fmt::v12::formatter<boost::basic_format<char> >*)this)->fmt::v12::detail::native_formatter<fmt::v12::basic_string_view<char>, char, fmt::v12::detail::type::string_type>::format(bfmt.boost::basic_format<char>::str(), ctx)) = fmt::v12::basic_appender<char>; boost::format = boost::basic_format<char>]’
  323 |     auto format(const boost::format& bfmt, FormatContext& ctx)

That function needs to be

auto format(const boost::format& bfmt, FormatContext& ctx) const

https://github.com/gnuradio/gnuradio/bl … ger.h#L323
Still exists in the 3.11git tag, but  seems gone in https://github.com/gnuradio/gnuradio/bl … o/logger.h so I've no idea what the upstream plans itr are.

=> https://aur.archlinux.org/packages/gnuradio-git ?

Edit: or since it's an inline function you can also just edit the local header in place.

Thanks for the reply.

So is this error a red herring? The other output you quoted was just a note though I dont know how serious I should take it (is it a 'last output is where it failed' kinda thing?) Sorry for my unfamiliarity with the cpp compilation process.

/usr/include/fmt/base.h:2323:29: error: passing ‘const fmt::v12::formatter<boost::basic_format<char> >’ as ‘this’ argument discards qualifiers [-fpermissive]
 2323 |     ctx.advance_to(cf.format(*static_cast<qualified_type*>(arg), ctx));
      |                    ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Offline

#4 2025-11-24 07:56:34

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,519

Re: [SOLVED] C++ libfmt compile time error

They're all the same, template errors are confusing wink
(Hence the note wtf this is actually triggered)

Edit /usr/include/gnuradio/logger.h and set the function const, error should™ go away.

Offline

#5 2025-11-24 18:48:10

talowicz
Member
Registered: 2024-08-13
Posts: 20

Re: [SOLVED] C++ libfmt compile time error

seth wrote:

They're all the same, template errors are confusing wink
(Hence the note wtf this is actually triggered)

Edit /usr/include/gnuradio/logger.h and set the function const, error should™ go away.

Awesome, that fixed it. Had another error but used my power of reading to add the #include <bitset> line to the necessary file. Thanks for the help and have a nice day smile

Offline

Board footer

Powered by FluxBB