【发布时间】:2021-12-22 21:58:14
【问题描述】:
当我尝试从 ros2 编译 cv_bridge 时,我需要帮助解决这个 cmake boost python3 发现问题,它使用一个名为 colcon 的构建工具,然后是 CMake。 colcon 构建错误信息:
> colcon build --symlink-install --merge-install
...
--- stderr: cv_bridge
CMake Error at C:/Program Files/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Boost (missing: python3) (found version "1.76.0")
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.22/Modules/FindBoost.cmake:2360 (find_package_handle_standard_args)
CMakeLists.txt:32 (find_package)
我尝试过的:
- 安装不同版本的 boost:1.58、1.67、1.76
- 将 cv_bridge 的 CMakeLists.txt 中的 boost 库的路径添加到 Boost_INCLUDE_DIRS:
if(NOT ANDROID)
find_package(PythonLibs)
list(APPEND Boost_INCLUDE_DIRS "C:/Program Files/boost/boost_1_76_0")
list(APPEND Boost_INCLUDE_DIRS "C:/Program Files/boost/boost_1_76_0/stage/lib")
- 将
libboost_python38-vc142-mt-gd-x64-1_76.lib重命名为libboost_python38.lib和libboost_python3.lib - 使用 bootstrap.bat 和 b2 从源代码编译 Boost 或使用 zip 文件安装。
- 在这里和其他地方寻找答案,这导致我尝试了上面的事情
我的想法已经用完了,任何帮助将不胜感激!
【问题讨论】:
-
尝试配置版本
find_package来定位boost。在使用find_package之前设置Boost_ROOT;或者,将您安装 boost 的目录添加到使用 b2 (.\b2 ... "--prefix=some/path" ... install) 到CMAKE_PREFIX_PATH。find_package(Boost REQUIRED COMPONENTS python CONFIG)。此外请注意,theFindPythonLibsmodule 自 cmake 3.12 起已弃用 -
感谢费边!我尝试设置 Boost_ROOT,为此还需要将策略 CMP0074 设置为 NEW,但没有成功。同样将
C:\Program Files\boost\boost_1_76_0添加到CMAKE_PREFIX_PATH也不起作用。配置版本也不起作用。配置版本找不到FindPython3Config.cmake,因为它不存在。我发现这个thread 似乎cmake config 停止寻找它告诉它与boost 1.70 及更高版本...
标签: boost cmake windows-10 ros2