FindCUDAToolkit: Fails to locate nvToolsExt, no error nor warning
I'm trying to build my cuda-api-wrappers repository on Windows machines. Specifically, I'm using a GitHub actions runner VM, running Windows 10, with MSVS 2019. My CMakeLists.txt has the following relevant parts (edited for brevity):
PROJECT(cuda-api-wrappers
(snip)
LANGUAGES CUDA CXX)
(snip)
find_package(CUDAToolkit REQUIRED)
(snip)
target_link_libraries(nvtx INTERFACE CUDA::cudart)
(snip)
target_link_libraries(nvtx PRIVATE CUDA::nvToolsExt)
The configuration fails; the logs are available here, but here are the relevant parts:
(snip)
Downloading CUDA Network Installer for 11.5.0 from: https://developer.download.nvidia.com/compute/cuda/11.5.0/network_installers/cuda_11.5.0_win10_network.exe
Downloading Complete
Installing CUDA 11.5.0. Subpackages nvcc_11.5 visual_studio_integration_11.5 curand_dev_11.5 nvrtc_dev_11.5 nvtx_11.5 cudart_11.5 visual_studio_integration_11.5 nsight_nvtx_11.5
CUDA_PATH C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.5
(snip)
-- The CUDA compiler identification is NVIDIA 11.5.50
-- The CXX compiler identification is MSVC 19.29.30136.0
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.5/bin/nvcc.exe - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
(snip)
-- Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.5/include (found version "11.5.50")
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - not found
-- Found Threads: TRUE
-- Automatic GPU detection failed. Building for common architectures.
-- Autodetected CUDA architecture(s): 5.3;6.0;6.1;7.0;7.5;8.0;8.6;8.6+PTX
-- Configuring done
CMake Error at CMakeLists.txt:39 (add_library):
Target "nvtx" links to target "CUDA::nvToolsExt" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
I'm certain CMake should have found CUDA::nvToolsExt
under these circumstances. But even if somehow it failed locating the relevant headers/libraries - it should either fail in finding the CUDA toolkit, or warn about only partially finding it. Neither of these happen.
As for the error log, the only suspicious parts are:
(snip)
2021-11-09T22:05:16.7511619Z D:\a\cuda-api-wrappers\cuda-api-wrappers\build\CMakeFiles\CMakeTmp>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.5\bin\nvcc.exe" -gencode=arch=compute_52,code=\"compute_52,compute_52\" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.5\include" --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -Xcompiler="/EHsc -Zi -Ob0 -v" -g -D_WINDOWS -D"CMAKE_INTDIR=\"Debug\"" -D_MBCS -D"CMAKE_INTDIR=\"Debug\"" -Xcompiler "/EHsc /W1 /nologo /Od /FdcmTC_5d2ea.dir\Debug\vc142.pdb /FS /Zi /RTC1 /MDd /GR" -o cmTC_5d2ea.dir\Debug\CMakeCUDACompilerABI.obj "C:\Program Files\CMake\share\cmake-3.21\Modules\CMakeCUDACompilerABI.cu"
2021-11-09T22:05:16.7515190Z
2021-11-09T22:05:16.7516418Z cl : Command line warning D9002: ignoring unknown option '-v' [D:\a\cuda-api-wrappers\cuda-api-wrappers\build\CMakeFiles\CMakeTmp\cmTC_5d2ea.vcxproj]
2021-11-09T22:05:16.7517626Z
2021-11-09T22:05:16.7518848Z cl : Command line warning D9002: ignoring unknown option '-v' [D:\a\cuda-api-wrappers\cuda-api-wrappers\build\CMakeFiles\CMakeTmp\cmTC_5d2ea.vcxproj]
2021-11-09T22:05:16.7519731Z
2021-11-09T22:05:16.7520228Z CMakeCUDACompilerABI.cu
2021-11-09T22:05:16.7520656Z
2021-11-09T22:05:16.7522038Z cl : Command line warning D9002: ignoring unknown option '-v' [D:\a\cuda-api-wrappers\cuda-api-wrappers\build\CMakeFiles\CMakeTmp\cmTC_5d2ea.vcxproj]
2021-11-09T22:05:16.7523931Z
2021-11-09T22:05:16.7527027Z LINK : warning LNK4044: unrecognized option '/v'; ignored [D:\a\cuda-api-wrappers\cuda-api-wrappers\build\CMakeFiles\CMakeTmp\cmTC_5d2ea.vcxproj]
2021-11-09T22:05:16.7528450Z
2021-11-09T22:05:16.7529811Z Creating library D:/a/cuda-api-wrappers/cuda-api-wrappers/build/CMakeFiles/CMakeTmp/Debug/cmTC_5d2ea.lib and object D:/a/cuda-api-wrappers/cuda-api-wrappers/build/CMakeFiles/CMakeTmp/Debug/cmTC_5d2ea.exp
2021-11-09T22:05:16.7531134Z
2021-11-09T22:05:16.7531993Z cmTC_5d2ea.vcxproj -> D:\a\cuda-api-wrappers\cuda-api-wrappers\build\CMakeFiles\CMakeTmp\Debug\cmTC_5d2ea.exe
2021-11-09T22:05:16.7532720Z
2021-11-09T22:05:16.7532955Z
2021-11-09T22:05:16.7533139Z
2021-11-09T22:05:16.7533369Z
2021-11-09T22:05:16.7533930Z Parsed CUDA implicit include dir info from above output: rv=start
2021-11-09T22:05:16.7534985Z warn: unable to parse implicit include dirs!
2021-11-09T22:05:16.7535556Z
2021-11-09T22:05:16.7535792Z
2021-11-09T22:05:16.7536516Z Parsed CUDA implicit link information from above output:
2021-11-09T22:05:16.7537360Z link line regex: [^( *|.*[/\])(link\.exe|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)]
2021-11-09T22:05:16.7538537Z ignore line: [Change Dir: D:/a/cuda-api-wrappers/cuda-api-wrappers/build/CMakeFiles/CMakeTmp]
2021-11-09T22:05:16.7539307Z ignore line: []
2021-11-09T22:05:16.7541133Z ignore line: [Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin/MSBuild.exe cmTC_5d2ea.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.11.1+3e40a09f8 for .NET Framework]
2021-11-09T22:05:16.7543043Z ignore line: [Copyright (C) Microsoft Corporation. All rights reserved.]
2021-11-09T22:05:16.7543774Z ignore line: []
2021-11-09T22:05:16.7544717Z ignore line: [ Compiling CUDA source file C:\Program Files\CMake\share\cmake-3.21\Modules\CMakeCUDACompilerABI.cu...]
2021-11-09T22:05:16.7545670Z ignore line: [ ]
2021-11-09T22:05:16.7549609Z ignore line: [ D:\a\cuda-api-wrappers\cuda-api-wrappers\build\CMakeFiles\CMakeTmp>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.5\bin\nvcc.exe" -gencode=arch=compute_52 code=\"compute_52 compute_52\" -gencode=arch=compute_52 code=\"sm_52 compute_52\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.5\include" --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -Xcompiler="/EHsc -Zi -Ob0 -v" -g -D_WINDOWS -D"CMAKE_INTDIR=\"Debug\"" -D_MBCS -D"CMAKE_INTDIR=\"Debug\"" -Xcompiler "/EHsc /W1 /nologo /Od /FdcmTC_5d2ea.dir\Debug\vc142.pdb /FS /Zi /RTC1 /MDd /GR" -o cmTC_5d2ea.dir\Debug\CMakeCUDACompilerABI.obj "C:\Program Files\CMake\share\cmake-3.21\Modules\CMakeCUDACompilerABI.cu" ]
2021-11-09T22:05:16.7555063Z ignore line: [cl : Command line warning D9002: ignoring unknown option '-v' [D:\a\cuda-api-wrappers\cuda-api-wrappers\build\CMakeFiles\CMakeTmp\cmTC_5d2ea.vcxproj]]
2021-11-09T22:05:16.7558960Z ignore line: [cl : Command line warning D9002: ignoring unknown option '-v' [D:\a\cuda-api-wrappers\cuda-api-wrappers\build\CMakeFiles\CMakeTmp\cmTC_5d2ea.vcxproj]]
2021-11-09T22:05:16.7560586Z ignore line: [ CMakeCUDACompilerABI.cu]
2021-11-09T22:05:16.7562124Z ignore line: [cl : Command line warning D9002: ignoring unknown option '-v' [D:\a\cuda-api-wrappers\cuda-api-wrappers\build\CMakeFiles\CMakeTmp\cmTC_5d2ea.vcxproj]]
2021-11-09T22:05:16.7563318Z ignore line: [LINK : warning LNK4044: unrecognized option '/v']
2021-11-09T22:05:16.7564419Z ignore line: [ ignored [D:\a\cuda-api-wrappers\cuda-api-wrappers\build\CMakeFiles\CMakeTmp\cmTC_5d2ea.vcxproj]]
2021-11-09T22:05:16.7566296Z ignore line: [ Creating library D:/a/cuda-api-wrappers/cuda-api-wrappers/build/CMakeFiles/CMakeTmp/Debug/cmTC_5d2ea.lib and object D:/a/cuda-api-wrappers/cuda-api-wrappers/build/CMakeFiles/CMakeTmp/Debug/cmTC_5d2ea.exp]
2021-11-09T22:05:16.7568160Z ignore line: [ cmTC_5d2ea.vcxproj -> D:\a\cuda-api-wrappers\cuda-api-wrappers\build\CMakeFiles\CMakeTmp\Debug\cmTC_5d2ea.exe]
2021-11-09T22:05:16.7569188Z ignore line: []
2021-11-09T22:05:16.7569632Z ignore line: []
2021-11-09T22:05:16.7570042Z implicit libs: []
2021-11-09T22:05:16.7570506Z implicit objs: []
2021-11-09T22:05:16.7570929Z implicit dirs: []
2021-11-09T22:05:16.7571390Z implicit fwks: []
... and I wouldn't be able to deduce from this that there's any trouble with nvToolsExt.
Edited by Brad King