ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

opencv lib conflict

asked 2021-04-16 11:18:10 -0500

Lin Zhao gravatar image

updated 2021-04-19 16:37:43 -0500

Hi, I am using ubuntu 20.04 with ROS noetic. Since I want to use opencv contrib lib, I build and install the opencv 4.2 and contrib from source to my path.

After install, I export LD_LIBRARY_PATH and PATH in the ~/.bashrc file. like this:

export  PATH=/home/lin/develop/3rd/opencv/install/opencv-4.2.0/bin/:$PATH
export LD_LIBRARY_PATH=/home/lin/develop/3rd/opencv/install/opencv-4.2.0/lib/:$LD_LIBRARY_PATH

Also, in the CMakelists.txt, I include new installed path, like below, and all the directory output are right.

SET(OpenCV_DIR /home/lin/develop/3rd/opencv/install/opencv-4.2.0/lib/cmake/opencv4/)   
find_package(OpenCV 4.2)    
message(STATUS "OpenCV library status:")  
message(STATUS "    config: ${OpenCV_DIR}")  
message(STATUS "    version: ${OpenCV_VERSION}")  
message(STATUS "    libraries: ${OpenCV_LIBS}")  
message(STATUS "    include path: ${OpenCV_INCLUDE_DIRS}")

But when I build my project, still have the warning like:

Cannot generate a safe runtime search path for target test_cv because files in some directories may conflict with libraries in implicit directories:
runtime library [libopencv_calib3d.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in: /home/lin/develop/3rd/opencv/install/opencv-4.2.0/lib

When not include image_transport in the cmakelist.txt, it looks fine. Why image_transport always to find lib from /usr/lib/x86_64-linux-gnu.

Seems all the lib link to /usr/lib/x86_64-linux-gnu. Any suggestions to fix this issue? Or the right way to use opencv_contrib in ROS? Thanks so much.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-04-20 20:43:52 -0500

Lin Zhao gravatar image

what I did is to uninstall cv_bridge by sudo dpkg --remove --force-depends ros-noetic-cv-bridge.
Then build from source with new installed opencv and opencv_contrib.
In your own project cmakelists.xtx, add SET(cv_bridge_DIR /home/lin/develop/ros/ros_ws/devel/share/cv_bridge/cmake/)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-04-16 11:18:10 -0500

Seen: 10,429 times

Last updated: Apr 20 '21