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:
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
to libboost_python38.lib
and libboost_python3.lib
I have run out of ideas, please any help will be greatly appreciated!
I got a similar issue while compiling ros noetic on my Fedora. It was able to find Boost 1.76.0
so I thought the issue should be with the python component. I guess it was not able to find the right libboost_python
version. So when I checked for the library I found it at this location: /usr/lib64/libboost_python310.so
.
So I updated the cv_bridge/CMakeLists.txt
to specifically use 3.10 version :
if(NOT ANDROID)
find_package(PythonLibs)
if(PYTHONLIBS_VERSION_STRING VERSION_LESS "3.8")
# Debian Buster
find_package(Boost REQUIRED python37)
else()
# Ubuntu Focal
# Because I am using python 3.10 I updated
# this line. If you are using a version less
# than 3.8, then update the previous line
# Updated line
find_package(Boost REQUIRED python310)
endif()
else()
find_package(Boost REQUIRED)
endif()
Setting it to specifically find the 3.10 version fixed the issue and I was able to compile.
EDIT: Didn't realize that the question was for Windows Platform but this answer may still help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With