尝试“制作” CUDA SDK,ld找不到库,ldconfig说可以
我知道还有很多其他与此类似的问题,但是没有一个解决方案适合我
基本上,制作 SDK 示例文件时,我得到 /usr/bin/ld:找不到-lcuda
这将是一个足够简单的“找到库并将其扔给 ldconfig”,除了 ldconfig 已经说它有它......
$ 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
而且我检查了,有一个符号链接 libcuda.so ->; libcuda.so.1
但我仍然很困惑为什么 libcuda.so -> ...
没有出现,
我一定是错过了一些非常明显的东西。有什么想法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
ldconfig
仅处理运行时库,而ld
处理构建时库。根据您安装 CUDA 库的方式,您可能需要为构建时使用的符号链接安装额外的包,或者您可能需要将-L
选项传递给 gcc 或 ld 以便告诉它构建时符号链接在哪里。ldconfig
deals only with runtime libraries, whereasld
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.添加到 .bash_profile
和源 .bash_profile
Add to .bash_profile
and source .bash_profile
尝试在编译器/链接器命令行上的 -lcuda 之前添加 -L/usr/local/cuda/lib 。
Try adding -L/usr/local/cuda/lib before -lcuda on the compiler/linker command line.