written in front
The author's environment:
Ubuntu 20.04, ROS-noetic.
The following is my own solution for your reference.
1. Problem description
When I was compiling the ROS program, which involved the program vision_opencv/cv_bridge
, the following error occurred:
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake:117 (find_package):
Could not find a package configuration file provided by "boost_python3"
(requested version 1.71.0) with any of the following names:
boost_python3Config.cmake
boost_python3-config.cmake
Add the installation prefix of "boost_python3" to CMAKE_PREFIX_PATH or set
"boost_python3_DIR" to a directory containing one of the above files. If
"boost_python3" provides a separate development package or SDK, be sure it
has been installed.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake:182 (boost_find_component)
/usr/share/cmake-3.16/Modules/FindBoost.cmake:443 (find_package)
CMakeLists.txt:17 (find_package)
The error screenshot is as follows:
Two, the solution
The reason for this is mainly
Modification method:
replace vision_opencv/cv_bridge/CMakeLists.txt
the following statement in :
if(NOT ANDROID)
find_package(PythonLibs)
if(PYTHONLIBS_VERSION_STRING VERSION_LESS 3)
find_package(Boost REQUIRED python)
else()
find_package(Boost REQUIRED python3)
endif()
else()
find_package(Boost REQUIRED)
endif()
change into:
if(NOT ANDROID)
find_package(PythonLibs)
# if(PYTHONLIBS_VERSION_STRING VERSION_LESS 3)
find_package(Boost REQUIRED python)
# else()
# find_package(Boost REQUIRED python3)
# endif()
else()
find_package(Boost REQUIRED)
endif()
reference link
[1] ethz-asl/maplab. Error with boost dependency #368 [EB/OL]. https://github.com/ethz-asl/kalibr/issues/368, 2021-03-02/2023-01-16 .
[2] (The method of this blog has not been tested successfully) Classmate Fei. boost_python3 [EB/OL]. https://blog.csdn.net/z1872385/article/details/124782647, 2022-05-15/2023- 01-16.