开发者

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 -> libcu开发者_Python百科dart.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?


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.


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜