简体   繁体   中英

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. 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.

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.

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

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.

in ~/.bashrc add the following

export PATH=/usr/local/cuda-5.0/bin:$PATH

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

in the following file -> /etc/ld.so.conf.d/cuda.conf

/usr/local/cuda-5.0/lib64

run: sudo ldconfig

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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