The CUDA compiler identification is unknown 解决

x33g5p2x  于2022-07-13 转载在 其他  
字(1.1k)|赞(0)|评价(0)|浏览(472)

nvcc cmakelist编译报错:

Error in Cmake "The CUDA compiler identification is unknown" 

nvcc is not able to compile a simple test program 

原因1:

GCC8
我安装的是cuda10.2因为需要gcc8和gcc8-libs依赖所以一起安装。
下载链接,注意版本对应。
https://archive.archlinux.org/packages/g/gcc8-libs
https://archive.archlinux.org/packages/g/gcc8
下载安装后直接运行。

CUDA
下载链接,选择需要的版本。
https://archive.archlinux.org/packages/c/cuda
下载安装后直接运行。
重启后生效

原文链接:https://blog.csdn.net/qq_40503480/article/details/114922236

查看环境变量:

echo $PATH

echo $LD_LIBRARY_PATH

nvcc is not able to compile a simple test program 

解决方法3,

pytorch - TensorRT (C++ API) undefined reference to `createNvOnnxParser_INTERNAL' - Stack Overflow

sudo update-alternatives --config gcc

我的解决方法,同事帮忙下找到原因:

cmake_minimum_required(VERSION 3.1) 
project(trt_cls VERSION 1.0)            
enable_language(CUDA)

注释掉:

enable_language(CUDA)

就找到cuda编译器了。

报错:

undefined reference to symbol 'cudaFree@@libcudart.so.10.2’

解决方法:

加cudart 

target_link_libraries(trt_cls nvinfer nvinfer_plugin nvparsers cudart "stdc++fs" ${OpenCV_LIBS})

undefined reference to `createNvOnnxParser_INTERNAL'

解决:

添加:nvonnxparser

target_link_libraries(trt_cls nvinfer nvinfer_plugin nvparsers cudart nvonnxparser "stdc++fs" ${OpenCV_LIBS})

相关文章

微信公众号

最新文章

更多