尝试在Windows 10 ROS 2上编译cv_bridge软件包时出现“找不到Boost(丢失:python)(找到的版本1.58.0)”

时间:2019-11-12 19:25:05

标签: boost cmake boost-python ros2

我一直在尝试编译cv_bridge软件包,Windows 2上的Ros 2破折号(不是我的选择)。最初我有一个错误,指出不存在boost lib,因此我通过boost-msvc-12安装了choco,现在找到了一个版本,但没有python软件包。尝试在我的工作空间上运行colcon build时,输出为:

Starting >>> cv_bridge
Starting >>> image_geometry
--- stderr: cv_bridge
CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find Boost (missing: python) (found version "1.58.0")
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/CMake/share/cmake-3.16/Modules/FindBoost.cmake:2162 (find_package_handle_standard_args)
  CMakeLists.txt:31 (find_package)


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

Summary: 0 packages finished [4.03s]
  1 package failed: cv_bridge
  1 package aborted: image_geometry
  1 package had stderr output: cv_bridge
  3 packages not processed

cv_bridge的引用boost的cmakeLists.txt代码如下所示(大多数已注释的内容来自我已经尝试过的东西):

# find_package(Boost COMPONENTS Python REQUIRED)
# set(BOOST_ROOT, "C:/local/")
# set(Boost_INCLUDE_DIRS, "C:/local/boost_1_67_0")
# message( ${Boost_LIBRARY_DIRS} )

if(NOT ANDROID)
  find_package(PythonLibs 3.7 REQUIRED)
  if(PYTHONLIBS_VERSION_STRING VERSION_LESS 3)
    find_package(Boost  REQUIRED python)
  else()

    find_package(Boost REQUIRED)
    # set(Boost_INCLUDE_DIRS, "C:/local/boost_1_58_0/")
    # set(Boost_LIBRARY_DIRS, "C:/local/boost_1_58_0/stage/lib/")

    if(Boost_VERSION LESS 106500)
      set(_Boost_PYTHON_HEADERS "boost/python.hpp")
      find_package(Boost REQUIRED python)
    else()
      # This is a bit of a hack to suppress a warning
      #   No header defined for python3; skipping header check
      # Which should only affect Boost versions < 1.67
      # Resolution for newer versions:
      #  https://gitlab.kitware.com/cmake/cmake/issues/16391
      if (Boost_VERSION LESS 106700)
        set(_Boost_PYTHON3_HEADERS "boost/python.hpp")
      endif()
      find_package(Boost COMPONENTS python3 REQUIRED)
    endif()
  endif()
else()
  find_package(Boost REQUIRED)
endif()

find_package(sensor_msgs REQUIRED)
find_package(OpenCV 3 REQUIRED
  COMPONENTS
    opencv_core
    opencv_imgproc
    opencv_imgcodecs
  CONFIG
)

include_directories(include ${Boost_INCLUDE_DIRS})

到目前为止,我已经尝试过:

  • 通过choco(1.67.0)安装另一个版本的Boost,但我无法接受cmake的识别。
  • 在cmakelists.txt文件内部或作为环境变量手动设置BOOST_ROOT。

请帮助,我没有找到任何相关信息,我怀疑您只是无法在Windows上运行cv_bridge

0 个答案:

没有答案