c++makefilecudalinker-errors

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?


Solution

  • 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.