I need help solving this cmake boost python3 find problem when trying to compile cv_bridge from ros2, which uses a build tool called colcon and in turn CMake. The colcon build error message:
> 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)
What I have tried:
- Installing different versions of boost: 1.58, 1.67, 1.76
- Adding to Boost_INCLUDE_DIRS the path to the boost libraries in the CMakeLists.txt of cv_bridge:
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")
- Renaming the
libboost_python38-vc142-mt-gd-x64-1_76.lib
tolibboost_python38.lib
andlibboost_python3.lib
- Compiling Boost from source with bootstrap.bat and b2 or installing with the zip file.
- Looked for answers here and elsewhere, which led me to tried things above
I have run out of ideas, please any help will be greatly appreciated!
find_package
to locate boost. SetBoost_ROOT
before usingfind_package
; alternatively add the directory you installed boost to using b2 (.\b2 ... "--prefix=some/path" ... install
) toCMAKE_PREFIX_PATH
.find_package(Boost REQUIRED COMPONENTS python CONFIG)
. Furthermore note that theFindPythonLibs
module is deprecated since cmake 3.12C:\Program Files\boost\boost_1_76_0
toCMAKE_PREFIX_PATH
did not work. Also the config version did not work. The config version failed to findFindPython3Config.cmake
since it does not exist. I found this thread where it seems that cmake config stops looking where its told to with boost 1.70 and above...