NVCC CUDA cross compiling cannot find “-lcudart”

人走茶凉 提交于 2019-12-06 13:44:36

问题


I have installed CUDA 5.0 and NVCC on my Ubuntu virtual machine and have had problems compiling even a basic CUDA C program. 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

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

  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.


回答1:


CUDA 5.5 was the first CUDA release to support ARM v7. 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.




回答2:


It turns out that the CUDA installer I was using from NVIDIA will not allow me to cross compile for my CARMA board, but it has to be downloaded from the manufacturer SECO.




回答3:


May be, it's a problem with Cuda Toolkits. The first the Cuda Toolkit 5.0 doesn't support Arm. The second the Cuda Toolkit 6.5 cross compile lost libcudart.so. I solved this problem is copying libcudart.so from the Cuda Toolkit 6.5 by Arm.




回答4:


add /etc/ld.so.conf this:

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

and run command: ldconfig your compile will find cudart lib



来源:https://stackoverflow.com/questions/30701263/nvcc-cuda-cross-compiling-cannot-find-lcudart

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!