本文主要是介绍【microros】解决 microros安装过程中的 undefined reference to `fmt::v6 问题,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
目录
- 问题
- 解决方案
- 参考链接
问题
在 ubuntu-20 arm 开发板上根据官方文档手动编译安装 microros 过程中,执行 ros2 run micro_ros_setup build_agent.sh
命令时,遇到了 undefined reference to fmt::v6
的问题,大概报错如下:
Your branch is up to date with 'origin/foxy'.
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
rclc_lifecycle: No definition of [osrf_testing_tools_cpp] for OS version [bionic]
rclc: No definition of [osrf_testing_tools_cpp] for OS version [bionic]
root@caremnano2-desktop:/home/microros_ws/microros_ws# ros2 run micro_ros_setup build_agent.sh
Building micro-ROS Agent
Starting >>> builtin_interfaces
Starting >>> micro_ros_msgs
Starting >>> microxrcedds_agent
Finished <<< microxrcedds_agent [2.40s]
Finished <<< micro_ros_msgs [4.28s]
Finished <<< builtin_interfaces [29.0s]
Starting >>> micro_ros_agent
--- stderr: micro_ros_agent
/home/microros_ws/microros_ws/install/microxrcedds_agent/lib/libmicroxrcedds_agent.so.2.0.0: undefined reference to `fmt::v6::internal::basic_data<void>::signs'
/home/microros_ws/microros_ws/install/microxrcedds_agent/lib/libmicroxrcedds_agent.so.2.0.0: undefined reference to `spdlog::logger::log_it_(spdlog::details::log_msg const&, bool, bool)'
/home/microros_ws/microros_ws/install/microxrcedds_agent/lib/libmicroxrcedds_agent.so.2.0.0: undefined reference to `int fmt::v6::internal::snprintf_float<double>(double, int, fmt::v6::internal::float_specs, fmt::v6::internal::buffer<char>&)'
/home/microros_ws/microros_ws/install/microxrcedds_agent/lib/libmicroxrcedds_agent.so.2.0.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > fmt::v6::internal::grouping_impl<char>(fmt::v6::internal::locale_ref)'
/home/microros_ws/microros_ws/install/microxrcedds_agent/lib/libmicroxrcedds_agent.so.2.0.0: undefined reference to `int fmt::v6::internal::format_float<long double>(long double, int, fmt::v6::internal::float_specs, fmt::v6::internal::buffer<char>&)'
/home/microros_ws/microros_ws/install/microxrcedds_agent/lib/libmicroxrcedds_agent.so.2.0.0: undefined reference to `int fmt::v6::internal::snprintf_float<long double>(long double, int, fmt::v6::internal::float_specs, fmt::v6::internal::buffer<char>&)'
/home/microros_ws/microros_ws/install/microxrcedds_agent/lib/libmicroxrcedds_agent.so.2.0.0: undefined reference to `int fmt::v6::internal::format_float<double>(double, int, fmt::v6::internal::float_specs, fmt::v6::internal::buffer<char>&)'
collect2: error: ld returned 1 exit status
make[2]: *** [micro_ros_agent] Error 1
make[1]: *** [CMakeFiles/micro_ros_agent.dir/all] Error 2
make: *** [all] Error 2
---
Failed <<< micro_ros_agent [1.83s, exited with code 2]
解决方案
经过摸索,在执行 ros2 run micro_ros_setup build_agent.sh
命令之前从源码编译安装一个 6.x
版本的 fmt
库即可,具体步骤如下:
- 如果已经遇到该错误,可以先清除
micro_ros_agent
的编译安装缓存
cd ~/microros_ws
rm -r build/micro_ros_agent
rm -r install/micro_ros_agent
- 从源码编译安装
fmt-6.x
,我在 ubuntu-20 系统上编译安装的是fmt-6.1.2
wget https://github.com/fmtlib/fmt/archive/refs/tags/6.1.2.zip
unzip 6.1.2.zip
cd fmt-6.1.2
mkdir build && cd build && cmake .. && make -j4
sudo make install
- 继续编译
micro_ros_agent
ros2 run micro_ros_setup build_agent.sh
source install/local_setup.bash
参考链接
Microros 官方编译安装文档
https://micro.ros.org/docs/tutorials/core/first_application_linux/
build_agent.sh fails while trying to go through tutorial
https://github.com/micro-ROS/micro-ROS-Agent/issues/50
这篇关于【microros】解决 microros安装过程中的 undefined reference to `fmt::v6 问题的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!