opencv lib conflict
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.