Whilst making the SDK samples make fails on ld and it reports that it can’t find -lcuda, even though /usr/lib32/libcuda.so.1 and /usr/lib64/libcuda.so.1 exist
Perhaps you also don’t want to erase the other library paths :) I have this in my .bashrc instead
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda/lib64/
Setting LD_LIBRARY_PATH will have no effect on your problem. My guess is that you have installed the CUDA toolkit in a non-standard location. For the SDK makefile, you need to either set CUDA_INSTALL_PATH to the root path of the toolkit installation, or edit this line in common.mk:
The problem the original poster is having is a linking problem. Nothing you can do to link loader settings will help.
Leaving that aside, I think modifying the link loader cache to include things like paths to CUDA is a very bad idea. Explicitly setting LD_LIBRARY_PATH allows fine grain control over versions (for example I have both CUDA 2.3 and CUDA 3.0 beta installed, and editing the link loader cache eliminates any control over which version of the library is found). Tools like Ocelot and barra rely on using reimplemented versions of the CUDA runtime libraries which intercept API calls and pass them to emulation code. They can never work if you hard code CUDA paths into the link library cache.
The best way to handle this stuff is using the excellent modules package. Using modules I can do this:
avid@cuda:~$ module avail
------------------------------------------- /opt/env/Modules/versions -------------------------------------------
3.2.7
-------------------------------------- /opt/env/Modules/3.2.7/modulefiles ---------------------------------------
acml/4.3.0 cuda/3.0b goto2/1.09 modules use.own
acml/4.3.0mp dot module-cvs mpich2/r1.1.1p1
cuda/2.3(default) goto/1.19 module-info null
avid@cuda:~$ module load cuda/2.3
avid@cuda:~$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2009 NVIDIA Corporation
Built on Thu_Jul_30_09:24:36_PDT_2009
Cuda compilation tools, release 2.3, V0.2.1221
avid@cuda:~$ module unload cuda
avid@cuda:~$ module load cuda/3.0b
avid@cuda:~$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2009 NVIDIA Corporation
Built on Mon_Oct_26_09:40:14_PDT_2009
Cuda compilation tools, release 3.0, V0.2.1221
avid@cuda:~$ module list
Currently Loaded Modulefiles:
1) cuda/3.0b
that is, I can dynamically select whichever CUDA version I want, and all of the paths/libraries/compiler flags are automagically set for me and everything works seamlessly.
I had the same problem after installing cuda5.5 in Ubuntu 12.04. The system is searching for the device drivers that run the display, but they have not been installed in the expected place. The libcuda.so and libcuda.so.1 files were installed in the following directories:
/usr/lib32/nvidia-current-updates/
/usr/lib/nvidia-current-updates/
I adapted a post I saw elsewhere here and created a symbolic link:
cd /usr/lib
sudo ln -s /usr/lib/nvidia-current-updates/libcuda.so libcuda.so
I should add, if you are not sure where on your system the libcuda.so driver files are located, there is an easy way to search:
cd /
find . -name libcuda* > ~/results
cat results
The files compile now, but I don’t know if everything works yet.