I am trying to compile and run a program in CUDA 7.0. I have already sets the $PATH and $LD_LIBRARY_PATH varialbles to CUDA-7.0 directory. When I run it, it gives me “error while loading shared libraries: libcudart.so.6.5: cannot open shared object file: No such file or directory”
Wondering how it finds that it needs to look for libcudart.so.6.5, where libcudart.so.7.0 is present on the LD_LIBRARY_PATH.
Output from my screen
zubair@NVIDIA-GTX570:~/code/Problem Set 1$ echo $PATH
/usr/local/cuda-7.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
zubair@NVIDIA-GTX570:~/code/Problem Set 1$ echo $LD_LIBRARY_PATH
/usr/local/cuda-7.0/lib64::/usr/local/cuda/lib64
zubair@NVIDIA-GTX570:~/code/Problem Set 1$ ./HW1 cinque_terre_small.jpg g1.jpg
./HW1: error while loading shared libraries: libcudart.so.6.5: cannot open shared object file: No such file or directory
It’s remotely possible that the Makefile is modifying which version (i.e. the path) of nvcc that is used.
What seems more likely to me is that the version of openCV that you are using was built with CUDA 6.5 Using the nvcc from CUDA 7.0 but linking against an OpenCV library that was built with CUDA 6.5 will generate a dependency on both CUDA 7.0 and CUDA 6.5 in your final application (HW1).
What are the contents of the Makefile?
If you can locate where the OpenCV libraries are (may be in /usr/lib) try running ldd on them:
ldd /usr/lib/libopencv_core.so
I’m not sure above is exactly the right path or library name, but you should be able to figure that out. I’m also not sure which of the 3 openCV libraries might have the CUDA dependency, so you might have to try all 3.
If you find that the OpenCV libraries have a dependency on CUDA 6.5, and CUDA 6.5 is installed somewhere on your machine, it may be easier just to switch (modify your PATH and LD_LIBRARY_PATH) to use CUDA 6.5.