Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to 'Make' CUDA SDK, ld cannot find library, ldconfig says it can

I know there are many other questions similar to this one, but none of the solutions posited there are working for me

Basically, making the SDK sample files, i get /usr/bin/ld: cannot find -lcuda which would be an easy enough 'find the library and throw it to ldconfig', except ldconfig already says it has it...

$ sudo ldconfig -v | grep cuda
/usr/local/cuda/lib64:
    libcudartemu.so.3 -> libcudartemu.so.3.0.14
    libcudart.so.3 -> libcudart.so.3.0.14
/usr/local/cuda/lib:
    libcudartemu.so.3 -> libcudartemu.so.3.0.14
    libcudart.so.3 -> libcudart.so.3.0.14
    libcuda.so.1 -> libcuda.so.195.36.15
    libcuda.so.1 -> libcuda.so.195.36.15
    libicudata.so.42 -> libicudata.so.42.1

And I checked, there is a symlink libcuda.so -> libcuda.so.1 but I'm still confused as to why libcuda.so -> ... doesnt show up

I must be missing something really obvious. Any ideas?

like image 859
Bolster Avatar asked Apr 26 '10 19:04

Bolster


2 Answers

ldconfig deals only with runtime libraries, whereas ld deals with build-time libraries. Depending on how you installed the CUDA libraries, you may need to install an additional package for the symlink used at buildtime, or you may need to pass a -L option to gcc or ld in order to tell it where the build-time symlink is.

like image 51
Ignacio Vazquez-Abrams Avatar answered Oct 24 '22 16:10

Ignacio Vazquez-Abrams


Add to .bash_profile

export PATH=/usr/local/cuda/bin:$PATH
export LPATH=/usr/lib/nvidia-current:$LPATH
export LIBRARY_PATH=/usr/lib/nvidia-current:$LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/lib/nvidia-current:/usr/local/cuda/lib64:/usr/local/cuda/lib:$LD_LIBRARY_PATH

and source .bash_profile

like image 26
ppirate Avatar answered Oct 24 '22 17:10

ppirate