描述:ubuntu20.04在执行cmake -S . -B build时出现、
CMake Error at /usr/local/share/cmake-3.25/Modules/CMakeDetermineCompilerId.cmake:739 (message):
Compiling the CUDA compiler identification source file
"CMakeCUDACompilerId.cu" failed.
Compiler: /usr/bin/nvcc
Build flags:
Id flags: --keep;--keep-dir;tmp -v
The output was:
255
#$ _SPACE_=
#$ _CUDART_=cudart
#$ _HERE_=/usr/lib/nvidia-cuda-toolkit/bin
#$ _THERE_=/usr/lib/nvidia-cuda-toolkit/bin
#$ _TARGET_SIZE_=
#$ _TARGET_DIR_=
#$ _TARGET_SIZE_=64
#$ NVVMIR_LIBRARY_DIR=/usr/lib/nvidia-cuda-toolkit/libdevice
#$
PATH=/usr/lib/nvidia-cuda-toolkit/bin:/usr/local/cuda-11.8/bin/:/usr/local/cuda-11.8/bin:/usr/local/cuda-11.8/bin:/home/zzx/.vscode-server/bin/863d2581ecda6849923a2118d93a088b0745d9d6/bin/remote-cli:/home/zzx/miniconda3/envs/py3.8/bin:/home/zzx/miniconda3/condabin:/usr/local/cuda-11.8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program
Files (x86)/Common Files/Oracle/Java/javapath:/mnt/c/Program
Files/Zetane:/mnt/f/anaconda202011:/mnt/f/anaconda202011/Library/mingw-w64/bin:/mnt/f/anaconda202011/Library/usr/bin:/mnt/f/anaconda202011/Library/bin:/mnt/f/anaconda202011/Scripts:/mnt/c/Program
Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2/bin:/mnt/c/Program
Files/NVIDIA GPU Computing
Toolkit/CUDA/v10.2/libnvvp:/mnt/c/windows/system32:/mnt/c/windows:/mnt/c/windows/System32/Wbem:/mnt/c/windows/System32/WindowsPowerShell/v1.0:/mnt/c/windows/System32/OpenSSH:/mnt/c/Program
Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA
Corporation/NVIDIA NvDLISR:/mnt/c/Program Files/NVIDIA GPU Computing
Toolkit/CUDA/v10.2/extras/CUPTI/lib64:/mnt/c/Program Files/NVIDIA GPU
Computing Toolkit/CUDA/v10.2/cudnn/bin:/mnt/c/Program
Files/dotnet:/mnt/f/Program
Files/Git/cmd:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0:/mnt/c/WINDOWS/System32/OpenSSH:/mnt/f/Nsight
compete:/mnt/d/texlive/2020/bin/win32:/mnt/c/Users/Administrator/AppData/Local/Microsoft/WindowsApps:/mnt/e/pycharm/PyCharm
2020.1/bin:/mnt/c/Users/Administrator/.dotnet/tools:/mnt/e/pycharm/pycharm2023.3/PyCharm
Community Edition 2022.3.3/bin:/mnt/c/Program Files (x86)/MiKTeX
2.5/miktex/bin:/mnt/d/Users/Administrator/AppData/Local/Programs/Microsoft
VS Code/bin:/snap/bin
#$ LIBRARIES= -L/usr/lib/x86_64-linux-gnu/stubs -L/usr/lib/x86_64-linux-gnu
#$ rm tmp/a_dlink.reg.c
#$ gcc -D__CUDA_ARCH__=300 -E -x c++ -DCUDA_DOUBLE_MATH_FUNCTIONS
-D__CUDACC__ -D__NVCC__ -D__CUDACC_VER_MAJOR__=10 -D__CUDACC_VER_MINOR__=1
-D__CUDACC_VER_BUILD__=243 -include "cuda_runtime.h" -m64
"CMakeCUDACompilerId.cu" > "tmp/CMakeCUDACompilerId.cpp1.ii"
#$ cicc --c++14 --gnu_version=90400 --allow_managed -arch compute_30 -m64
-ftz=0 -prec_div=1 -prec_sqrt=1 -fmad=1 --include_file_name
"CMakeCUDACompilerId.fatbin.c" -tused -nvvmir-library
"/usr/lib/nvidia-cuda-toolkit/libdevice/libdevice.10.bc"
--gen_module_id_file --module_id_file_name
"tmp/CMakeCUDACompilerId.module_id" --orig_src_file_name
"CMakeCUDACompilerId.cu" --gen_c_file_name
"tmp/CMakeCUDACompilerId.cudafe1.c" --stub_file_name
"tmp/CMakeCUDACompilerId.cudafe1.stub.c" --gen_device_file_name
"tmp/CMakeCUDACompilerId.cudafe1.gpu" "tmp/CMakeCUDACompilerId.cpp1.ii" -o
"tmp/CMakeCUDACompilerId.ptx"
#$ ptxas -arch=sm_30 -m64 "tmp/CMakeCUDACompilerId.ptx" -o
"tmp/CMakeCUDACompilerId.sm_30.cubin"
ptxas fatal : Value 'sm_30' is not defined for option 'gpu-name'
# --error 0xff --
Call Stack (most recent call first):
/usr/local/share/cmake-3.25/Modules/CMakeDetermineCompilerId.cmake:6 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
/usr/local/share/cmake-3.25/Modules/CMakeDetermineCompilerId.cmake:48 (__determine_compiler_id_test)
/usr/local/share/cmake-3.25/Modules/CMakeDetermineCUDACompiler.cmake:307 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:2 (project)
这个错误,cuda为11.8,环境没有问题
解决方法:cmake时加入指定参数来给参数初始化,加入nvcc路径、
cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CUDA_COMPILER=/usr/local/cuda-11.8/bin/nvcc文章来源:https://www.toymoban.com/news/detail-853885.html
如果有彻底解决的方法可以交流文章来源地址https://www.toymoban.com/news/detail-853885.html
到了这里,关于cmake工程出现CMake Error at /usr/local/share/cmake-3.25/Modules/CMakeDetermineCompilerId.cmake:739的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!