views:

1125

answers:

3

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?

+1  A: 

Try adding -L/usr/local/cuda/lib before -lcuda on the compiler/linker command line.

zvrba
FYI, Because of the grepping, libcuda isnt actually in /usr/local/cuda/lib, its in /usr/lib/nvidia-current/libcuda
Andrew Bolster
+3  A: 

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.

Ignacio Vazquez-Abrams
IANA experienced coder, so I understood roughly 70% of what you just said :D but is there somewhere to add these paths to instead of _Ling them all the time, similar to the $PATH envvar? I've already tried adding the directories to a conf file under ld.so.conf.d, but that fixed nothing.
Andrew Bolster
No. And modifying `/etc/ld.so.conf.d` only affects ld.so, which only affects runtime. If you want some sort of semi-permanent solution then you should look into creating a makefile for your project.
Ignacio Vazquez-Abrams
A: 

But how to add -L option to make command for SDK?

majk