简体   繁体   English

NVCC CUDA 交叉编译找不到“-lcudart”

[英]NVCC CUDA cross compiling cannot find “-lcudart”

I have installed CUDA 5.0 and NVCC on my Ubuntu virtual machine and have had problems compiling even a basic CUDA C program.我已经在我的 Ubuntu 虚拟机上安装了 CUDA 5.0 和 NVCC,甚至在编译一个基本的 CUDA C 程序时也遇到了问题。 The error is as follows:错误如下:

user@ubuntu:~/CUDA$ nvcc helloworld.cu -o helloworld.o -target-cpu-arch=ARM -ccbin=/usr/bin/arm-linux-gnueabi-gcc-4.6 --machine=32
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld: skipping incompatible /usr/local/cuda-5.0/bin/../lib/libcudart.so when searching for -lcudart
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld: skipping incompatible /usr/lib/libcudart.so when searching for -lcudart
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld: cannot find -lcudart
collect2: ld returned 1 exit status

I have tried to research this problem and came across this link: skipping incompatible libcudart.so when searching for -lcudart我试图研究这个问题并遇到了这个链接: 在搜索 -lcudart 时跳过不兼容的 libcudart.so

And so I followed the advice that was offered on that link and added所以我遵循了该链接上提供的建议并添加了

 /usr/local/cuda-5.0/lib64 

and

/usr/local/cuda-5.0/lib 

to my LD_LIBRARY_PATH environment variable and now this is the result of the到我的 LD_LIBRARY_PATH 环境变量,现在这是

  user@ubuntu:~/CUDA$ echo $LD_LIBRARY_PATH 
  /usr/local/cuda-5.0/lib:/usr/local/cuda-5.0/lib64
  user@ubuntu:~/CUDA$ 

However, the problem still persists, please help.但是问题依然存在,请大家帮忙。

CUDA 5.5 was the first CUDA release to support ARM v7. CUDA 5.5是第一个支持 ARM v7 的 CUDA 版本。 The CUDA 5.0 toolkit you installed does not have support, which is why it can't find the right version of the CUDA runtime library.您安装的 CUDA 5.0 工具包没有支持,这就是它找不到正确版本的 CUDA 运行时库的原因。

事实证明,我从 NVIDIA 使用的 CUDA 安装程序不允许我为我的 CARMA 板交叉编译,但必须从制造商 SECO 下载它。

May be, it's a problem with Cuda Toolkits.可能是,这是 Cuda Toolkits 的问题。 The first the Cuda Toolkit 5.0 doesn't support Arm.第一个 Cuda Toolkit 5.0 不支持 Arm。 The second the Cuda Toolkit 6.5 cross compile lost libcudart.so.第二个Cuda Toolkit 6.5 交叉编译丢失了libcudart.so。 I solved this problem is copying libcudart.so from the Cuda Toolkit 6.5 by Arm.我解决了这个问题是从 Arm 的 Cuda Toolkit 6.5 复制 libcudart.so。

in ~/.bashrc add the following在 ~/.bashrc 中添加以下内容

export PATH=/usr/local/cuda-5.0/bin:$PATH导出路径=/usr/local/cuda-5.0/bin:$PATH

export LD_LIBRARY_PATH=/usr/local/cuda-5.0/lib64:$LD_LIBRARY_PATH导出 LD_LIBRARY_PATH=/usr/local/cuda-5.0/lib64:$LD_LIBRARY_PATH

in the following file -> /etc/ld.so.conf.d/cuda.conf在以下文件中 -> /etc/ld.so.conf.d/cuda.conf

/usr/local/cuda-5.0/lib64 /usr/local/cuda-5.0/lib64

run: sudo ldconfig运行:sudo ldconfig

add /etc/ld.so.conf this:添加 /etc/ld.so.conf 这个:

/usr/local/cuda-5.0/lib /usr/local/cuda-5.0/lib64 /usr/local/cuda-5.0/lib /usr/local/cuda-5.0/lib64

and run command: ldconfig your compile will find cudart lib并运行命令:ldconfig 你的编译会找到 cudart lib

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM