参考步骤:
1)新建src目录:
C:\ros\rolling>vcs import --input https://gitcode.net/rose3/rose3/-/raw/master/ros2.rolling.repos src
2)run within a Visual Studio Command Prompt
c:\ros\rolling>colcon build --merge-install --cmake-args -G "Visual Studio 17 2022" -A x64
问题1:
--- stderr: fastcdr
CMake Error at CMakeLists.txt:84 (project):
No CMAKE_CXX_COMPILER could be found.
出错的cmakelists.txe是:
project(fastcdr VERSION "${LIB_VERSION_STR}" LANGUAGES CXX)
是cmake和Windows SDK版本的问题,可能是安装了多个SDK(见https://blog.csdn.net/qq_39482438/article/details/81013100 第3种情况),把所有sdk删除再重新安装最新的SDK后问题解决)
问题2:
1 package failed: uncrustify_vendor
打印出错信息:--event-handlers console_direct+
colcon build --merge-install --cmake-args -G "Visual Studio 17 2022" -A x64 --event-handlers console_direct+ --packages-select uncrustify_vendor
[Processing: uncrustify_vendor]
=== .\uncrustify_vendor (git) ===
fatal: unable to access 'https://github.com/uncrustify/uncrustify.git/': Failed to connect to github.com port 443 after 21073 ms: Couldn't connect to server
ros2中,xxx_vendor的子工程,都是xxx的一个编译封装,cmake下载github失败就把下载地址改一下: https://gitcode.net/rose3/uncrustify_vendor/-/merge_requests/1。
问题3:
1 package failed: pybind11_vendor
Performing download step for 'pybind11_vendor'
=== .\pybind11_vendor (git) ===
Could not determine ref type of version: fatal: unable to access 'https://github.com/pybind/pybind11.git/': Failed to connect to github.com port 443 after 21061 ms
如果要查看具体编译错误,可以使用一下参数: --event-handlers console_direct+
例如:
colcon build --merge-install --event-handlers console_direct+ --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo --packages-up-to pybind11_vendor
问题4:
Could NOT find Bullet (missing: BULLET_DYNAMICS_LIBRARY
BULLET_COLLISION_LIBRARY BULLET_MATH_LIBRARY BULLET_SOFTBODY_LIBRARY
BULLET_INCLUDE_DIR)
源码编译安装:https://gitcode.net/rose3/bullet3.git
修正了原master branch中的cmake错误。
cmake编译选项:-DUSE_MSVC_RUNTIME_LIBRARY_DLL=ON -DINSTALL_LIBS=ON