pcl
pcl copied to clipboard
[compile with cuda] cmake cannot find cuda
Operating System and version: Windows 10 Compiler: CUDA 11.6 PCL Version: 1.14.1(8e844ea7cce63)
Previously I used vcpkg to install the cuda module of pcl :./vcpkg install pcl[cuda]. It works fine. Now I use the vcpkg toolchain to compile the PCL original source code, and it prompts me that it cannot find cuda: "No CUDA compiler found".
the Path has been set.
I also added the cuda global variables to the vcpkg environment
set(VCPKG_ENV_PASSTHROUGH_UNTRACKED HALCONROOT CUDA_PATH)
But it still can't find cuda, is there something I'm not noticing?
Now I use the vcpkg toolchain to compile the PCL original source code,
What do you mean exactly? Could you describe that in more detail, ideally with the commands you are using? Do you use the vcpkg --head
option?
@mvieth I mean I don't install PCL from vcpkg but compile PCL source code directly, using vcpkg's dependencies at the same time.
"C:\Program Files\CMake\bin\cmake.EXE" -DCMAKE_INSTALL_PREFIX=C:/program_on_git/thirdParty/pcl/out/install/VS+vcpkg -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe -DCMAKE_TOOLCHAIN_FILE=C:/src/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_OVERLAY_TRIPLETS=C:\src\vcpkg\sfr-registry\triplets -DBUILD_examples=ON -DWITH_CUDA=ON -DBUILD_GPU=ON -DBUILD_CUDA=ON -SC:/program_on_git/thirdParty/pcl -BC:/program_on_git/thirdParty/pcl/out/build/VS+vcpkg -G "Visual Studio 17 2022" -T host=x64 -A x64
I have had trouble when having multiple versions of cuda installed before as well. Generally we use the enable_language(cuda) option - so you could also try to make a minimal cmake working example and we can take it on from there.
For me (on Ubuntu Linux), setting the following CMake variables correctly sometimes helped CMake find cuda: -DCMAKE_CUDA_COMPILER=<path to nvcc executable>
, also CUDA_TOOLKIT_ROOT_DIR
, CUDAToolkit_ROOT
By tracing the cmake code, I found the problem.
C:\program_on_git\thirdParty\pcl\build\CMakeFiles\CheckCUDA> cmake . -G "Visual Studio 17 2022" -A "x64" -T "host=x64" -DCMAKE_GENERATOR_INSTANCE:INTERNAL="C:\Program Files\Microsoft Visual Studio\2022\Community"
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
CMake Error at C:/Program Files/CMake/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake:529 (message):
No CUDA toolset found.
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake:8 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
C:/Program Files/CMake/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake:53 (__determine_compiler_id_test)
C:/Program Files/CMake/share/cmake-3.28/Modules/CMakeDetermineCUDACompiler.cmake:135 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:2 (project)
In CMakeDetermineCompilerId.cmake
if(lang STREQUAL CUDA)
if(NOT CMAKE_VS_PLATFORM_TOOLSET_CUDA)
message(FATAL_ERROR "No CUDA toolset found.")
endif()
The problem is that when cuda is installed, some files will be copied to the visual studio folder, and I reinstalled visual studio some time ago, so reinstalling cuda or manually copying the files can solve the problem. This is a problem that has nothing to do with pcl, sorry I don't have it Debug carefully before raising an issue.