Skip to content

Can't build agent because of fmt #255

Open

Description

@Darkadius
  • Hardware description: Personnal computer running Ubuntu 24.04
  • Installation type: Micro-ros-setup, colcon-build, snap
  • Version or commit hash: jazzy
  • Current spdlog version: 1.15.0

Context:
I'm building a ros2 package based on linorobot2 which requires micro ros agent.

Behavior

Following the installation tutorial, I execute the ros2 run build_agent.sh command and get this error:

In file included from /home/darkadius/anaconda3/include/fmt/format.h:41,
                 from /home/darkadius/anaconda3/include/fmt/core.h:5,
                 from /home/darkadius/anaconda3/include/spdlog/fmt/fmt.h:28,
                 from /home/darkadius/anaconda3/include/spdlog/common.h:50,
                 from /home/darkadius/anaconda3/include/spdlog/spdlog.h:12,
                 from /home/darkadius/ros2_ws/build/micro_ros_agent/agent/src/xrceagent/include/uxr/agent/logger/Logger.hpp:23,
                 from /home/darkadius/ros2_ws/build/micro_ros_agent/agent/src/xrceagent/include/uxr/agent/transport/SessionManager.hpp:18,
                 from /home/darkadius/ros2_ws/build/micro_ros_agent/agent/src/xrceagent/include/uxr/agent/transport/Server.hpp:20,
                 from /home/darkadius/ros2_ws/build/micro_ros_agent/agent/src/xrceagent/include/uxr/agent/transport/tcp/TCPv6AgentLinux.hpp:19,
                 from /home/darkadius/ros2_ws/build/micro_ros_agent/agent/src/xrceagent/src/cpp/transport/tcp/TCPv6AgentLinux.cpp:15:

/home/darkadius/anaconda3/include/fmt/base.h: In instantiation of ‘fmt::v11::detail::value<Context>::value(const T&, fmt::v11::detail::custom_tag) [with T = dds::xrce::TransportAddress; typename std::enable_if<(! has_formatter<T, typename Context::char_type>()), int>::type <anonymous> = 0; Context = fmt::v11::context]’:
/home/darkadius/anaconda3/include/fmt/base.h:2208:65:   required from ‘fmt::v11::detail::value<Context>::value(T&) [with T = dds::xrce::TransportAddress; 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::v11::detail::has_to_string_view<T, void>::value)) && (! fmt::v11::detail::is_named_arg<T>::value)) && (! fmt::v11::detail::use_format_as<T>::value)) && (! fmt::v11::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::v11::context]’
/home/darkadius/anaconda3/include/fmt/base.h:2781:20:   required from ‘constexpr fmt::v11::detail::format_arg_store<Context, NUM_ARGS, NUM_NAMED_ARGS, DESC> fmt::v11::make_format_args(T& ...) [with Context = context; T = {const char [24], dds::xrce::TransportAddress}; int NUM_ARGS = 2; int NUM_NAMED_ARGS = 0; long long unsigned int DESC = 252]’
/home/darkadius/anaconda3/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 char (&)[24], dds::xrce::TransportAddress&}; spdlog::string_view_t = fmt::v11::basic_string_view<char>]’
/home/darkadius/anaconda3/include/spdlog/logger.h:80:13:   required from ‘void spdlog::logger::log(spdlog::source_loc, spdlog::level::level_enum, fmt::v11::format_string<T ...>, Args&& ...) [with Args = {const char (&)[24], dds::xrce::TransportAddress&}; fmt::v11::format_string<T ...> = fmt::v11::fstring<const char (&)[24], dds::xrce::TransportAddress&>]’
/home/darkadius/ros2_ws/build/micro_ros_agent/agent/src/xrceagent/include/uxr/agent/transport/util/InterfaceLinux.hpp:63:17:   required from here

/home/darkadius/anaconda3/include/fmt/base.h:2235:45: error: ‘fmt::v11::detail::type_is_unformattable_for<dds::xrce::TransportAddress, char> _’ has incomplete type
 2235 |     type_is_unformattable_for<T, char_type> _;

Solutions tried:

-Downgrading spdlog: Jazzy's rclpy requires spdlog 1.15.0
-Building libfmt from source from here : Gives the above error as the new libfmt wasn't detected
-Using the DUAGENT flag (both on/off) from here : Still gives me the above error
-Using the snap version from here : The package does build successfully, however, the only micro-ros-agent package on snap was the foxy version, which causes fatal compatibility issues upon launching the linorobot2 package

It feels like I've tried everything short of a complete ros2/ubuntu reinstall (which I'd like to avoid, obviously). Does anyone has some advice?

Activity

  1. 4ntn commented on Sep 30, 2025

    @4ntn
    Contributor

    Have you tried using micro-ROS agent through the Docker container?
    https://hub.docker.com/r/microros/micro-ros-agent

  2. nlitz88 commented on Mar 29, 2026

    @nlitz88

    Did you end up finding a solution? I am still running into this issue on Jazzy.

  3. nlitz88 commented on Mar 29, 2026

    @nlitz88

    Solution
    UPDATE: I got things working by running the following build command:

    colcon build --packages-up-to micro_ros_agent --cmake-args DMICROROSAGENT_SUPERBUILD=ON DUAGENT_USE_SYSTEM_LOGGER=OFF DSPDLOG_FMT_EXTERNAL=OFF
    

    Where the key flag was DSPDLOG_FMT_EXTERNAL=OFF.

    Context
    I looked through a number of threads:

    and the solution that seemed to come up most often was to run colcon build with the -DUAGENT_USE_SYSTEM_LOGGER=ON flag, so that it would just use the system version of spdlog. However, when I tried this with Jazzy, it appears that some type defined/used within Micro-XRCE-DDS-Agent was not compatible with these newer versions of spdlog and fmt (I think). AND, I couldn't just downgrade spdlog and fmt, as there were core jazzy packages that also depend on newer versions of spdlog and fmt.

    Therefore, it sounded like I was going to have to make that "private" spdlog version that Micro-XRCE-DDS-Agent was building as a part of its superbuild. However, I then found that older version of spdlog that it was using (v1.9.2 or something) was not going to be compatible with the newer version of fmt (v12) I had installed.

    Gemini was able to identify that spdlog's CMakeLists file has an option to use a bundled version of fmt (rather than the system version). Sure enough, when I turned DSPDLOG_FMT_EXTERNAL off, I was able to build it successfully.

    I'm no expert here, but I'm wondering if the more permanent fix might be to propagate that argument up through to the Micro-XRCE-DDS-Agent and the micro-ros-agent packages?

  4. mdicicco commented on Apr 23, 2026

    @mdicicco

    Your link out to the spdlog code (https://github.com/gabime/spdlog/blob/v1.x/CMakeLists.txt#L98) seems to indicate that the default value for SPDLOG_FMT_EXTERNAL is already set to OFF, doesn't it?

    option(SPDLOG_USE_STD_FORMAT "Use std::format instead of fmt library." OFF)

  5. nlitz88 commented on Apr 23, 2026

    @nlitz88

    Hmmm. Good point haha. I just went back and traced through the cmake files again, and I can't find where that flag would get set to ON anywhere in the chain 🤔. Now I'm really confused as to why this worked for me. Or rather--I am confused as to why it doesn't work for me when I don't explicitly set that flag--as it should be OFF by default, like you pointed out.

  6. mdicicco commented on Apr 23, 2026

    @mdicicco

    Good to see I'm not the only one struggling with this. I noticed this because colcon was printing a warning that the SPDLOG_FMT_EXTERNAL flag was not used. It's not a flag for micro_ros_agent so that makes sense, but I don't think it's being passed into the sub-build of spdlog. When you set SUPERBUILD=ON it seems to use agent/cmake/SuperBuild.cmake to manage the checkout of the sub repos and build them. I think that's probably the best place to make a focused change to get spdlog checked out and built properly, but I have not had any luck. I tried adding a new "ExternalProject_Add" section where I could specify CMAKE flags but it doesn't seem to work. If you want to try that approach, maybe you'll have more luck than I did.

  7. mdicicco commented on Apr 26, 2026

    @mdicicco

    I was able to get a fix working with SuperBuild.cmake fixes. I have it on my fork:
    https://github.com/mdicicco/micro-ROS-Agent/blob/jazzy-conda-fmt-spdlog-fix/micro_ros_agent/cmake/SuperBuild.cmake

    I can make a pull request if anyone things this will help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions