Why can't libcudart.so.4 be found when compiling the CUDA samples under Ubuntu? Why can't libcudart.so.4 be found when compiling the CUDA samples under Ubuntu? unix unix

Why can't libcudart.so.4 be found when compiling the CUDA samples under Ubuntu?


try:

32-bit: sudo ldconfig /usr/local/cuda/lib

64-bit: sudo ldconfig /usr/local/cuda/lib64

cheers


First these that you need is to concatenate the paths to the CUDA binaries and libraries. This is simply done by adding the following lines to your .bashrc file.

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

If you are using a 32-bit operating system change lib64 to lib

Second, there should have been some shared object files installed in /usr/lib or /usr/lib64, depending on your operating system. These object files should be contained in a directory called "nvidia". The two files we are concerned with are names libcuda.so.drivernumber and libOpenCL.so.somenumber. To differentiate between the actual shared object files just use ls -l. The symbolic links will show what they are actually linking to.

As root, execute the following commands:

ln -s /usr/lib64/nvidia/libcuda.so.somenumber /usr/lib64/libcuda.soln -s /usr/lib64/nvidia/libOpenCL.so.somenumber /usr/lib64/libOpenCL.so

That should allow you to compile all the sources in the SDK.

As of Cuda 5.5 and Ubuntu 12.04/12.10, the command above becomes (notice the Ubuntu and Cuda directory changes) for 64bit

ln -s /usr/local/cuda/lib64/libcuda.so.5.5 /usr/lib/libcuda.so.5.5

That is, the lib folders on Ubuntu as of 12.04 are lib32 and lib; the 64 is implicit, and cuda 5.5 and greater now installs to a different directory.


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

  32-bit: sudo ldconfig /usr/local/cuda/lib  64-bit: sudo ldconfig /usr/local/cuda/lib64

(refer: http://blog.csdn.net/shenchong721/article/details/21529295)

Works for me!