I have a program using OpenCV. I link the library using -L/path/to/opencv/lib
flags, and also the path to the library is specified using -Wl,-rpath
flag.
For some reason, when running ldd
, I see that the links to most of the OpenCV libraries are found(for example opencv_core). However, all the CUDA related libraries(such as opencv_cudaarithm) are not found.
This was fixed when I have added the OpenCV library path to LD_LIBRARY_PATH
, but I would have expected it to work without having to change LD_LIBRARY_PATH
, especially since the path to some of the libraries is resolved.
Does anyone have an idea what it could be?
Edit:
There is no error message
The output from ldd
before adding OpenCV to LD_LIBRARY_PATH
:
libopencv_imgcodecs.so.3.4 => /usr/Local/opencv/v.3.4.13/lib/libopencv_imgcodecs.so.3.4 (0x00007fcf7acd4000)
libopencv_imgproc.so.3.4 => /usr/Local/opencv/v.3.4.13/lib/libopencv_imgproc.so.3.4 (0x00007fcf7918e000)
libopencv_core.so.3.4 => /usr/Local/opencv/v.3.4.13/lib/libopencv_core.so.3.4 (0x00007fcf77fb0000)
libopencv_photo.so.3.4 => /usr/Local/opencv/v.3.4.13/lib/libopencv_photo.so.3.4 (0x00007fcf77dfe000)
libopencv_cudaimgproc.so.3.4 => not found
libopencv_cudaarithm.so.3.4 => not found
After adding OpenCV:
libopencv_imgcodecs.so.3.4 => /usr/Local/opencv/v.3.4.13/lib/libopencv_imgcodecs.so.3.4 (0x00007fcf7acd4000)
libopencv_imgproc.so.3.4 => /usr/Local/opencv/v.3.4.13/lib/libopencv_imgproc.so.3.4 (0x00007fcf7918e000)
libopencv_core.so.3.4 => /usr/Local/opencv/v.3.4.13/lib/libopencv_core.so.3.4 (0x00007fcf77fb0000)
libopencv_photo.so.3.4 => /usr/Local/opencv/v.3.4.13/lib/libopencv_photo.so.3.4 (0x00007fcf77dfe000)
libopencv_cudaimgproc.so.3.4 => /usr/Local/opencv/v.3.4.13/lib/libopencv_cudaimgproc.so.3.4 (0x00007fcf76b03000)
libopencv_cudaarithm.so.3.4 => /usr/Local/opencv/v.3.4.13/lib/libopencv_cudaarithm.so.3.4 (0x00007fcf74bed000)