首先给出重点,
打开vs2019的命令窗口,
>call C:\dev\ros2_humble\local_setup.bat
> mkdir -p d:/vROS2/rviz2_ws/src
> cd d:/vROS2/rviz2_ws/src
> git clone --recursive https://github.com/ros2/rviz.git rviz2
>cd rviz2
>git checkout humble
>cd ..
>cd ..
> colcon build --merge-install
期间碰到两个问题。
第一个问题:找不到patch.exe。
Starting >>> rviz_ogre_vendor
--- stderr: rviz_ogre_vendor
CMake Error at C:/Programs/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Patch (missing: Patch_EXECUTABLE)
Call Stack (most recent call first):
C:/Programs/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
C:/Programs/CMake/share/cmake-3.22/Modules/FindPatch.cmake:70 (find_package_handle_standard_args)
CMakeLists.txt:157 (find_package)
CMakeLists.txt:216 (build_ogre)
---
Failed <<< rviz_ogre_vendor [6.11s, exited with code 1]
Aborted <<< rviz_assimp_vendor [6.27s]
Summary: 0 packages finished [6.53s]
1 package failed: rviz_ogre_vendor
1 package aborted: rviz_assimp_vendor
1 package had stderr output: rviz_ogre_vendor
6 packages not processed
解决办法:确认已经安装好了git,把patch.exe所在的路径添加到环境变量中去。例如我的路径是(注意:为了避免可能的麻烦,一般我不用Program Files这样有空格的路径),
C:\Programs\Git\usr\bin\patch.exe
第二个问题:找不到路径:C:/ci/ws/install/include
Starting >>> rviz_common
--- stderr: rviz_common
CMake Error in CMakeLists.txt:
Imported target "tf2_geometry_msgs::tf2_geometry_msgs" includes
non-existent path
"C:/ci/ws/install/include"
in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:
* The path was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and references files it does not
provide.
解决方案:在c盘建立上述路径即可,里面是空白的无所谓。
这个是因为库程序的开发者会把参考引用文件放在这个位置 所引起的。
解决上述两个问题后,程序就正常编译成功了。期间,rviz_ogre_vendor和rviz_default_plugins用的时间最长,约10多分钟吧,其他的模块都很快。
本文结束。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)