找不到Boost-缺少python3组件



当尝试在ROS2中编译cv_bridge时,cmakefind_package找不到boost-python3包。

随后出现以下错误:

--- stderr: cv_bridge
CMake Error at /usr/local/Cellar/cmake/3.17.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
Could NOT find Boost (missing: python3) (found version "1.72.0")
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.17.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:445 (_FPHSA_FAILURE_MESSAGE)
/usr/local/Cellar/cmake/3.17.1/share/cmake/Modules/FindBoost.cmake:2145 (find_package_handle_standard_args)
CMakeLists.txt:32 (find_package)

---
Failed   <<< cv_bridge  [ Exited with code 1 ]

这是什么原因?

确保CMake使用内置的Boost CMake文件而不是Boost安装的文件修复了问题:

colcon build --symlink-install --cmake-args ' -DBoost_NO_BOOST_CMAKE:BOOL=0'

添加CMake参数-D Boost_NO_BOOST_CMAKE:BOOL=0

如本文所述和引用https://www.forum.freecadweb.org/viewtopic.php?f=4&t=39301:

这个命令告诉cmake不要直接使用boost中包含的cmake-config文件。相反,cmake中的配置文件与以前的boost版本一样使用。

最新更新