尝试交叉编译 CUDNN 示例时:
cp -r /usr/src/cudnn_samples_v8/ $HOME
cd $HOME/cudnn_samples_v8/mnistCUDNN
make clean
make TARGET_ARCH=aarch64 SBSA=1
错误如下:
CUDA_VERSION is 12020
Linking agains cublasLt = true
CUDA VERSION: 12020
TARGET ARCH: aarch64
HOST_ARCH: x86_64
TARGET OS: linux
nvlink warning : Skipping incompatible '/usr/local/cuda/lib64/libcudadevrt.a' when searching for -lcudadevrt
nvlink warning : Skipping incompatible '/usr/local/cuda/lib64/libcudadevrt.a' when searching for -lcudadevrt
nvlink warning : Skipping incompatible '/usr/local/cuda/lib64/libcudadevrt.a' when searching for -lcudadevrt
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/local/cuda/lib64/libcublasLt.so when searching for -lcublasLt
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/local/cuda/lib64/libcublasLt.so when searching for -lcublasLt
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/local/cuda/lib64/libcublasLt.so when searching for -lcublasLt
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/local/cuda/lib64/libcudart.so when searching for -lcudart
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/local/cuda/lib64/libcudart.so when searching for -lcudart
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/local/cuda/lib64/libcudart.so when searching for -lcudart
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/local/cuda/lib64/libcublas.so when searching for -lcublas
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/local/cuda/lib64/libcublas.so when searching for -lcublas
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/local/cuda/lib64/libcublas.so when searching for -lcublas
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: cannot find -lfreeimage: No such file or directory
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: cannot find -lfreeimage: No such file or directory
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/local/cuda/lib64/libcudadevrt.a when searching for -lcudadevrt
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/local/cuda/lib64/libcudadevrt.a when searching for -lcudadevrt
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/local/cuda/lib64/libcudadevrt.a when searching for -lcudadevrt
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/local/cuda/lib64/libcudart_static.a when searching for -lcudart_static
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/local/cuda/lib64/libcudart_static.a when searching for -lcudart_static
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/local/cuda/lib64/libcudart_static.a when searching for -lcudart_static
collect2: error: ld returned 1 exit status
>>> WARNING - FreeImage is not set up correctly. Please ensure FreeImage is set up correctly. <<<
[@] /usr/local/cuda/bin/nvcc -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -ccbin aarch64-linux-gnu-g++ -m64 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_72,code=sm_72 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_87,code=sm_87 -gencode arch=compute_90,code=sm_90 -gencode arch=compute_90,code=compute_90 -o fp16_dev.o -c fp16_dev.cu
[@] aarch64-linux-gnu-g++ -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -o fp16_emu.o -c fp16_emu.cpp
[@] aarch64-linux-gnu-g++ -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -o mnistCUDNN.o -c mnistCUDNN.cpp
[@] /usr/local/cuda/bin/nvcc -ccbin aarch64-linux-gnu-g++ -m64 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_72,code=sm_72 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_87,code=sm_87 -gencode arch=compute_90,code=sm_90 -gencode arch=compute_90,code=compute_90 -o mnistCUDNN fp16_dev.o fp16_emu.o mnistCUDNN.o -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib64 -lcublasLt -LFreeImage/lib/linux/aarch64 -LFreeImage/lib/linux -lcudart -lcublas -lcudnn -lfreeimage -lstdc++ -lm
libfreeimage3 libfreeimage-dev 已安装:
上述输出中的“ collect2: error: ld returned 1 exit status
”是什么意思?如何查找原因?
答案1
这GNU 链接器(ld
)是一个工具(其中之一) 在编译过程中调用,从项目中创建/调用的目标文件创建可执行文件。
collect2
是收集/检查链接器输出的工具。
collect2: error: ld returned 1 exit status
只是意味着上述链接操作没有成功,但这不是导致编译操作失败的真正原因,而是以前的错误的结果,您需要注意这些错误...例如:
cannot find -lfreeimage: No such file or directory
更多信息请参阅:
>>> WARNING - FreeImage is not set up correctly. Please ensure FreeImage is set up correctly. <<<
注意:libfreeimage
系统上的可用性可能不是导致该错误的唯一原因,但可能需要一些其他相关库,例如libcudnn
(部分灵感来自于你用nvidia
) 取决于您的项目。