0

我一直在尝试在 Windows 上编译包 cv_bridge, Ros 2 dashing(不是我的选择)。起初我有一个错误指出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

4

0 回答 0