找不到CMAKE_CUDA_COMPILER

aiqt4smr  于 2023-02-23  发布在  其他
关注(0)|答案(4)|浏览(578)

我正在尝试为CMake生成一个构建系统,但它向我抛出了一个错误,我已经几天没有设法修复了。我已经安装了VC 2017和CUDA最新版本。
在我的目录中,我创建了构建目录并运行:

cmake ..

之后,它开始创建它,但它没有找到CUDA编译器

C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build>cmake ..

-- Building for: Visual Studio 15 2017
-- The CXX compiler identification is MSVC 19.16.27027.1
-- The CUDA compiler identification is unknown
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:5 (project):

>  No CMAKE_CUDA_COMPILER could be found.

>-- Configuring incomplete, errors occurred!
See also "C:/Users/lenovo/Documents/Fax/4/Lasersko skeniranje/Projekat/Open3D-PointNet2-Semantic3D/tf_ops/build/CMakeFiles/CMakeOutput.log".

日志文件显示:

Compiling the CUDA compiler identification source file "CMakeCUDACompilerId.cu" failed.
Compiler:  
Build flags: 
Id flags:  -v;--keep;--keep-dir;tmp

The output was:
1
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 07-Mar-19 14:14:03.
Project "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" on node 1 (default targets).
PrepareForBuild:
  Creating directory "Debug\".
  Creating directory "Debug\CompilerIdCUDA.tlog\".
InitializeBuildStatus:
  Creating "Debug\CompilerIdCUDA.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
AddCudaCompileDeps:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.exe /E /nologo /showIncludes /TP /D__CUDACC__ /D_MBCS /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" /I. /FIcuda_runtime.h /c "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu" 
Project "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (1) is building "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (1:2) on node 1 (CudaBuildCore target(s)).
CudaBuildCore:
  Compiling CUDA source file CMakeCUDACompilerId.cu...
  cmd.exe /C "C:\Users\lenovo\AppData\Local\Temp\tmp5b923de4e22e4f04be6ba6f85d34ca98.cmd"
  "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir Debug -maxrregcount=0  --machine 32 --compile -cudart static  -g   -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc141.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu"

  C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir Debug -maxrregcount=0  --machine 32 --compile -cudart static  -g   -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc141.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu" 
  nvcc fatal   : 32 bit compilation is only supported for Microsoft Visual Studio 2013 and earlier
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations\CUDA 10.1.targets(757,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir Debug -maxrregcount=0  --machine 32 --compile -cudart static  -g   -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc141.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu"" exited with code 1. [C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj]
Done Building Project "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (CudaBuildCore target(s)) -- FAILED.
Done Building Project "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (default targets) -- FAILED.

Build FAILED.

"C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (default target) (1) ->
"C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (CudaBuildCore target) (1:2) ->
(CudaBuildCore target) -> 
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations\CUDA 10.1.targets(757,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir Debug -maxrregcount=0  --machine 32 --compile -cudart static  -g   -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc141.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu"" exited with code 1. [C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:02.74

Compiling the CUDA compiler identification source file "CMakeCUDACompilerId.cu" failed.
Compiler:  
Build flags: 
Id flags:  -v;--keep;--keep-dir;tmp

The output was:
1
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 07-Mar-19 14:14:06.
Project "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" on node 1 (default targets).
PrepareForBuild:
  Creating directory "Debug\".
  Creating directory "Debug\CompilerIdCUDA.tlog\".
InitializeBuildStatus:
  Creating "Debug\CompilerIdCUDA.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
AddCudaCompileDeps:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.exe /E /nologo /showIncludes /TP /D__CUDACC__ /D_MBCS /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" /I. /FIcuda_runtime.h /c "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu" 
Project "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (1) is building "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (1:2) on node 1 (CudaBuildCore target(s)).
CudaBuildCore:
  Compiling CUDA source file CMakeCUDACompilerId.cu...
  cmd.exe /C "C:\Users\lenovo\AppData\Local\Temp\tmp6a6113e32a54449682bdc11103da68f9.cmd"
  "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir Debug -maxrregcount=0  --machine 32 --compile -cudart static  -g   -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc141.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu"

  C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir Debug -maxrregcount=0  --machine 32 --compile -cudart static  -g   -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc141.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu" 
  nvcc fatal   : 32 bit compilation is only supported for Microsoft Visual Studio 2013 and earlier
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations\CUDA 10.1.targets(757,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir Debug -maxrregcount=0  --machine 32 --compile -cudart static  -g   -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc141.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu"" exited with code 1. [C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj]
Done Building Project "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (CudaBuildCore target(s)) -- FAILED.
Done Building Project "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (default targets) -- FAILED.

Build FAILED.

"C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (default target) (1) ->
"C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (CudaBuildCore target) (1:2) ->
(CudaBuildCore target) -> 
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations\CUDA 10.1.targets(757,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir Debug -maxrregcount=0  --machine 32 --compile -cudart static  -g   -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc141.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu"" exited with code 1. [C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:02.65

有什么想法吗?我似乎无法解决这个问题...我正在运行Win10

q9rjltbz

q9rjltbz1#

看起来您需要手动指定nvcc * 的完整路径,但我不喜欢这个想法。
你可以这样做:

cmake -DCMAKE_CUDA_COMPILER:PATH=/usr/local/cuda/bin/nvcc ...other cmake options...

这将编译预期的东西,除了它不会自动添加include文件夹。我仍然在寻找如何处理第二部分,而不包括FindCUDA.cmake文件。

7kqas0il

7kqas0il2#

根据日志,编译CMakeCUDACompilerId.cu时的问题是nvcc fatal : 32 bit compilation is only supported for Microsoft Visual Studio 2013 and earlier,CMake内部使用CMakeCUDACompilerId.cu来确保编译器工作。
由于某些原因,CMake决定编译32位的文件,这是不支持了。由于CMake版本没有指定,我建议更新CMake。

wpcxdonn

wpcxdonn3#

尝试cmake -G "Microsoft Visual Studio 15 2017 Win64" ..

nnt7mjpx

nnt7mjpx4#

我知道这是一个老问题,但我也遇到过同样的问题,也许,我的解决方案可以帮助其他人。实际上,我总是安装CUDA作为自定义安装,因为我不想安装样本和文档。第一次安装时,我忘记勾选Visual Studio集成选项。这使得CUDA编译器出于某种原因不可见。在我重新安装CUDA勾选选项后,它工作了。

相关问题