编译kobuki_ros与kobuki_interfaces时遇rosidl_generate_interfaces错误
完整错误复现步骤
环境要求
Ubuntu 22.04 LTS ROS2 HUMBLE PYTHON3
安装/配置指南
安装pyenv
若Python3版本 < 3.8,跳过此步骤
安装完成后执行:
pyenv install -v 3.7.16
所有已安装的Python版本位于pyenv目录下,可通过以下命令查看:
ls ~/.pyenv/versions
卸载Python版本的命令(请勿执行):
pyenv uninstall <version>
查看系统中所有Python版本:
pyenv versions
若你的Python版本 >3.8,记得先source ROS2环境。
创建工作区并设置本地Python版本:
mkdir turtlebot_ws && cd turtlebot_ws pyenv local 3.7.16 # 修改此文件夹的本地Python版本 python -V
预期输出:
Python 3.7.16
在此文件夹中下载配置kobuki工作区的脚本:
# 从pypi获取构建工具(colcon, vcstools)的虚拟环境启动器 wget https://raw.githubusercontent.com/kobuki-base/kobuki_documentation/release/1.0.x/resources/venv.bash || exit 1 # 针对eigen、sophus的自定义构建配置选项 wget https://raw.githubusercontent.com/kobuki-base/kobuki_documentation/release/1.0.x/resources/colcon.meta || exit 1 # 需git克隆的仓库列表 wget https://raw.githubusercontent.com/kobuki-base/kobuki_documentation/release/1.0.x/resources/kobuki_standalone.repos || exit 1
使用本地Python版本创建虚拟环境:
pyenv virtualenv 3.7.16 .venv ### pyenv virtualenv <版本名> <项目名>
激活虚拟环境:
pyenv activate .venv
从源码安装kobuki:
mkdir src # vcs工具负责获取.repos文件中列出的分布式仓库 vcs import ./src < kobuki_standalone.repos || exit 1
进入src文件夹,删除原ecl_lite并克隆指定版本:
cd src rm -rf ecl_lite git clone https://github.com/stonier/ecl_lite.git
克隆另外两个仓库并安装依赖:
git clone https://github.com/kobuki-base/kobuki_ros_interfaces.git git clone https://github.com/kobuki-base/kobuki_ros.git pip install catkin_pkg lark empy
回到工作区根目录执行构建命令:
cd .. # 构建所有包 colcon build --merge-install --cmake-args -DBUILD_TESTING=OFF # 禁用未使用的cmake变量警告(例如sophus不使用BUILD_TESTING) colcon build --merge-install --cmake-args -DBUILD_TESTING=OFF --no-warn-unused-cli # 构建单个包 colcon build --merge-install --packages-select kobuki_core --cmake-args -DBUILD_TESTING=OFF # 详细构建所有包 VERBOSE=1 colcon build --merge-install --event-handlers console_direct+ --cmake-args -DBUILD_TESTING=OFF # 构建带调试符号的发布版本 colcon build --merge-install --cmake-args -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo
更新源码工作区
vcs pull ./src source install/setup.bash pyenv .venv deactivate
错误信息
--- stderr: kobuki_ros_interfaces CMake Error at /opt/ros/humble/share/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake:42 (get_executable_path): Unknown CMake command "get_executable_path". Call Stack (most recent call first): /opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:130 (rosidl_adapt_interfaces) CMakeLists.txt:55 (rosidl_generate_interfaces) --- Failed <<< kobuki_ros_interfaces [0.64s, exited with code 1] Aborted <<< ecl_eigen [0.05s] Aborted <<< ecl_config [0.07s] Aborted <<< ecl_mpl [0.07s] Aborted <<< ecl_command_line [0.07s]
单独构建kobuki_ros_interfaces可成功,但全量构建所有包时失败。
内容的提问来源于stack exchange,提问作者nyongcyongs98
相关产品推荐
相关产品推荐

