Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catkin_make error in cv_bridge building #3

Closed
MehmetcanKaymaz opened this issue Sep 3, 2021 · 7 comments
Closed

catkin_make error in cv_bridge building #3

MehmetcanKaymaz opened this issue Sep 3, 2021 · 7 comments

Comments

@MehmetcanKaymaz
Copy link

When I try to build cv_bridge, I get this error :

desktop:~/catkin_ws$ catkin_make
Base path: /home/deep-drone/catkin_ws
Source space: /home/deep-drone/catkin_ws/src
Build space: /home/deep-drone/catkin_ws/build
Devel space: /home/deep-drone/catkin_ws/devel
Install space: /home/deep-drone/catkin_ws/install

Running command: "cmake /home/deep-drone/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/deep-drone/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/deep-drone/catkin_ws/install -G Unix Makefiles" in "/home/deep-drone/catkin_ws/build"

-- Using CATKIN_DEVEL_PREFIX: /home/deep-drone/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/melodic
-- This workspace overlays: /opt/ros/melodic
-- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.17", minimum required is "2")
-- Using PYTHON_EXECUTABLE: /usr/bin/python2
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/deep-drone/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python2 (found version "2.7.17")
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.29
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 4 packages in topological order:
-- ~~ - opencv_tests
-- ~~ - vision_opencv (metapackage)
-- ~~ - cv_bridge
-- ~~ - image_geometry
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'opencv_tests'
-- ==> add_subdirectory(vision_opencv/opencv_tests)
-- +++ processing catkin metapackage: 'vision_opencv'
-- ==> add_subdirectory(vision_opencv/vision_opencv)
-- +++ processing catkin package: 'cv_bridge'
-- ==> add_subdirectory(vision_opencv/cv_bridge)
-- Found PythonLibs: /usr/lin/x86_64-linux-gnu/libpython2.7.so (found version "2.7.17")
CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:1626 (message):
No header defined for python37; skipping header check
Call Stack (most recent call first):
vision_opencv/cv_bridge/CMakeLists.txt:13 (find_package)

-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- python37
-- Found OpenCV: /usr/local (found suitable version "3.4.1", minimum required is "3") found components: opencv_core opencv_imgproc opencv_imgcodecs
-- Found OpenCV: /usr/local (found version "3.4.1") found components: opencv_calib3d opencv_core opencv_cudaarithm opencv_cudabgsegm opencv_cudacodec opencv_cudafeatures2d opencv_cudafilters opencv_cudaimgproc opencv_cudalegacy opencv_cudaobjdetect opencv_cudaoptflow opencv_cudastereo opencv_cudawarping opencv_cudev opencv_dnn opencv_features2d opencv_flann opencv_highgui opencv_imgcodecs opencv_imgproc opencv_ml opencv_objdetect opencv_photo opencv_shape opencv_stitching opencv_superres opencv_video opencv_videoio opencv_videostab
-- Found PythonLibs: /usr/lin/x86_64-linux-gnu/libpython2.7.so (found suitable version "2.7.17", minimum required is "2.7")
-- +++ processing catkin package: 'image_geometry'
-- ==> add_subdirectory(vision_opencv/image_geometry)
-- Found OpenCV: /usr/local (found version "3.4.1")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/deep-drone/catkin_ws/build

Running command: "make -j4 -l4" in "/home/deep-drone/catkin_ws/build"

[ 0%] Built target geometry_msgs_generate_messages_lisp
[ 0%] Built target sensor_msgs_generate_messages_py
[ 0%] Built target sensor_msgs_generate_messages_lisp
[ 0%] Built target sensor_msgs_generate_messages_nodejs
[ 0%] Built target geometry_msgs_generate_messages_eus
[ 0%] Built target std_msgs_generate_messages_py
[ 0%] Built target geometry_msgs_generate_messages_cpp
[ 0%] Built target std_msgs_generate_messages_eus
[ 0%] Built target std_msgs_generate_messages_cpp
[ 0%] Built target geometry_msgs_generate_messages_nodejs
[ 0%] Built target geometry_msgs_generate_messages_py
[ 0%] Built target sensor_msgs_generate_messages_cpp
[ 0%] Built target std_msgs_generate_messages_lisp
[ 0%] Built target std_msgs_generate_messages_nodejs
[ 0%] Built target sensor_msgs_generate_messages_eus
[ 33%] Built target image_geometry
[ 66%] Built target cv_bridge
make[2]: *** No rule to make target '/usr/lin/x86_64-linux-gnu/libpython2.7.so', needed by '/home/deep-drone/catkin_ws/devel/lib/python2.7/dist-packages/cv_bridge/boost/cv_bridge_boost.so'. Stop.
make[2]: *** Waiting for unfinished jobs....
[ 77%] Building CXX object vision_opencv/cv_bridge/src/CMakeFiles/cv_bridge_boost.dir/module_opencv4.cpp.o
[ 88%] Building CXX object vision_opencv/cv_bridge/src/CMakeFiles/cv_bridge_boost.dir/module.cpp.o
In file included from /usr/include/python2.7/numpy/ndarrayobject.h:27:0,
from /home/deep-drone/catkin_ws/src/vision_opencv/cv_bridge/src/module.hpp:26,
from /home/deep-drone/catkin_ws/src/vision_opencv/cv_bridge/src/module_opencv4.cpp:3:
/home/deep-drone/catkin_ws/src/vision_opencv/cv_bridge/src/module.hpp: In function ‘void* do_numpy_import()’:
/usr/include/python2.7/numpy/__multiarray_api.h:1537:144: error: return-statement with no value, in function returning ‘void*’ [-fpermissive]
#define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NUMPY_IMPORT_ARRAY_RETVAL; } }
^
/usr/include/python2.7/numpy/__multiarray_api.h:1537:144: note: in definition of macro ‘import_array’
#define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NUMPY_IMPORT_ARRAY_RETVAL; } }
^~~~~~
In file included from /usr/include/python2.7/numpy/ndarrayobject.h:27:0,
from /home/deep-drone/catkin_ws/src/vision_opencv/cv_bridge/src/module.hpp:26,
from /home/deep-drone/catkin_ws/src/vision_opencv/cv_bridge/src/module.cpp:35:
/home/deep-drone/catkin_ws/src/vision_opencv/cv_bridge/src/module.hpp: In function ‘void* do_numpy_import()’:
/usr/include/python2.7/numpy/__multiarray_api.h:1537:144: error: return-statement with no value, in function returning ‘void*’ [-fpermissive]
PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NUMPY_IMPORT_ARRAY_RETVAL; } }
^
/usr/include/python2.7/numpy/__multiarray_api.h:1537:144: note: in definition of macro ‘import_array’
PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NUMPY_IMPORT_ARRAY_RETVAL; } }
^~~~~~
vision_opencv/cv_bridge/src/CMakeFiles/cv_bridge_boost.dir/build.make:86: recipe for target 'vision_opencv/cv_bridge/src/CMakeFiles/cv_bridge_boost.dir/module_opencv4.cpp.o' failed
make[2]: *** [vision_opencv/cv_bridge/src/CMakeFiles/cv_bridge_boost.dir/module_opencv4.cpp.o] Error 1
vision_opencv/cv_bridge/src/CMakeFiles/cv_bridge_boost.dir/build.make:62: recipe for target 'vision_opencv/cv_bridge/src/CMakeFiles/cv_bridge_boost.dir/module.cpp.o' failed
make[2]: *** [vision_opencv/cv_bridge/src/CMakeFiles/cv_bridge_boost.dir/module.cpp.o] Error 1
CMakeFiles/Makefile2:1040: recipe for target 'vision_opencv/cv_bridge/src/CMakeFiles/cv_bridge_boost.dir/all' failed
make[1]: *** [vision_opencv/cv_bridge/src/CMakeFiles/cv_bridge_boost.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed

What should I do to solve this problem?

@arjunskumar
Copy link
Owner

@MehmetcanKaymaz Can you try

sudo apt-get update
sudo apt-get install libpython-dev

@MehmetcanKaymaz
Copy link
Author

@arjunskumar I tried but still have the same and I wonder why it uses python 2.7. should I use python 3?

@MehmetcanKaymaz
Copy link
Author

@arjunskumar this is my CMakeList.txt file maybe the problem is in here,

cmake_minimum_required(VERSION 3.0.2)
project(cv_bridge)

find_package(catkin REQUIRED COMPONENTS rosconsole sensor_msgs)

if(NOT ANDROID)
find_package(PythonLibs)

if(PYTHONLIBS_VERSION_STRING VERSION_LESS "3.8")
# Debian Buster
find_package(Boost REQUIRED python3)
else()
# Ubuntu Focal
find_package(Boost REQUIRED python)
endif()
else()
find_package(Boost REQUIRED)
endif()

set(_opencv_version 4)
find_package(OpenCV 4 QUIET)
if(NOT OpenCV_FOUND)
message(STATUS "Did not find OpenCV 4, trying OpenCV 3")
set(_opencv_version 3)
endif()

find_package(OpenCV 3 REQUIRED PATHS /usr/local/share/OpenCV NO_DEFAULT_PATH
COMPONENTS
opencv_core
opencv_imgproc
opencv_imgcodecs
CONFIG
)

catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS rosconsole sensor_msgs
DEPENDS OpenCV
CFG_EXTRAS cv_bridge-extras.cmake
)

catkin_python_setup()
include(/usr/local/share/OpenCV/OpenCVConfig.cmake)
include_directories(include ${Boost_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})

if(NOT ANDROID)
add_subdirectory(python)
endif()
add_subdirectory(src)
if(CATKIN_ENABLE_TESTING)
add_subdirectory(test)
endif()

install the include folder

install(
DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)

@arjunskumar
Copy link
Owner

@MehmetcanKaymaz Please check your python version

if(PYTHONLIBS_VERSION_STRING VERSION_LESS "3.8")
# Debian Buster
find_package(Boost REQUIRED python3)

if your version is less than 3.8,it will take python2
so the workaround is to change else condition to

find_package(Boost REQUIRED python3)

@MehmetcanKaymaz
Copy link
Author

@arjunskumar The problem is not about finding boost I think

python version is 2.7.17
python3 version is 3.6.9
boost version is 1.65.1

@MehmetcanKaymaz
Copy link
Author

I solved the problem using ros-perception/vision_opencv#329 (comment)

@arjunskumar
Copy link
Owner

Thanks @MehmetcanKaymaz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants