System with CUDA 7 installed giving error for libcudart.so.6.5

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

Your nvcc compile command used the version of nvcc from CUDA 6.5

Show you compile command (for HW1), and immediately prior to your compile command, show the results of running

nvcc --version

output from screen as requested by you

zubair@NVIDIA-GTX570:~/code/Problem Set 1$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Mon_Feb_16_22:59:02_CST_2015
Cuda compilation tools, release 7.0, V7.0.27
zubair@NVIDIA-GTX570:~/code/Problem Set 1$ make
g++ -c main.cpp -O3 -Wall -Wextra -m64 -I /usr/local/cuda-7.0/include -I /usr/include
nvcc -c student_func.cu -O3 -arch=sm_35 -Xcompiler -Wall -Xcompiler -Wextra -m64
student_func.cu:49:6: warning: unused parameter ‘h_rgbaImage’ [-Wunused-parameter]
void your_rgba_to_greyscale(const uchar4 * const h_rgbaImage, uchar4 * const d_rgbaImage,
^
g++ -c compare.cpp -I /usr/include -O3 -Wall -Wextra -m64 -I /usr/local/cuda-7.0/include
g++ -c reference_calc.cpp -I /usr/include -O3 -Wall -Wextra -m64 -I /usr/local/cuda-7.0/include
nvcc -o HW1 main.o student_func.o compare.o reference_calc.o -L /usr/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -O3 -arch=sm_35 -Xcompiler -Wall -Xcompiler -Wextra -m64

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.

Hi there! I have the exact same problem:

error while loading shared libraries: libcudart.so.6.5: cannot open shared object file: No such file or directory

I use before running my makefile:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
export PATH=$PATH:/usr/local/cuda/

This is my makefile:

GENCODE_SM20	:= -arch=sm_20 
GENCODE_FLAGS	:= $(GENCODE_SM20)
LDFLAGS		:= -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib -lcuda -lcudart
CCFLAGS		:= -pthread -std=gnu++11 -lstdc++
NVCCFLAGS	:= -rdc=true -c
INCLUDES	:= -I/usr/local/cuda/include 
NVCC            := nvcc
GCC             := g++

all: build

build: KD_tree

InsideBox.o: InsideBox.cu
	$(NVCC) $(NVCCFLAGS) $(GENCODE_FLAGS) $(INCLUDES) -o $@ $<
	$(NVCC) -dlink  $(GENCODE_FLAGS)  -o InsideBox_link.o $@

KD_tree.o: main.cpp KD_tree.hpp simple_kd_tree.hpp sorter.hpp
	$(GCC) $(CCFLAGS) $(INCLUDES) -o $@ -c $<

KD_tree: InsideBox.o KD_tree.o InsideBox_link.o
	$(GCC) $(CCFLAGS) -o $@ $+ $(LDFLAGS) $(EXTRA_LDFLAGS)

run: build
	./KD_tree

Any ideas how I could fix this, would be very helpful!

This is not correct:

export PATH=$PATH:/usr/local/cuda/

it should be:

export PATH=$PATH:/usr/local/cuda/bin

but I’m not sure that is your issue.

After you do this:

export PATH=$PATH:/usr/local/cuda/bin

what is the result of:

echo $PATH

and

which nvcc

?

Thanks for that. I struggled with it for days. Works perfectly now.

Dan

export CUDA=/usr/local/cuda-7.0/

export CUDA=/usr/local/cuda-7.0/