CUDA: configure error with Clang 15
I have a minimal CMakeLists.txt
project with native CUDA and clang compiler:
cmake_minimum_required(VERSION 3.25.3)
set(CMAKE_CUDA_COMPILER clang++)
set(CMAKE_CUDA_ARCHITECTURES 61)
project(foo LANGUAGES CUDA)
add_executable(foo foo.cu)
When I try to build it, I'm getting this error:
$ cmake -B build -S . -G Ninja
-- The CUDA compiler identification is unknown
-- Check for working CUDA compiler: /usr/bin/clang++
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
_CMAKE_CUDA_WHOLE_FLAG
CMake Error at /usr/share/cmake/Modules/CMakeTestCUDACompiler.cmake:89 (try_compile):
Failed to generate test project build system.
Call Stack (most recent call first):
CMakeLists.txt:4 (project)
-- Configuring incomplete, errors occurred!
See also "/home/lahwaacz/foo/build/CMakeFiles/CMakeOutput.log".
See also "/home/lahwaacz/foo/build/CMakeFiles/CMakeError.log".
The CMakeError.log
file contains:
Checking whether the CUDA compiler is NVIDIA using "" did not match "nvcc: NVIDIA \(R\) Cuda compiler driver":
clang version 15.0.7
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Checking whether the CUDA compiler is NVIDIA using "" did not match "nvcc: NVIDIA \(R\) Cuda compiler driver":
clang-15: error: no input files
Checking whether the CUDA compiler is Clang using "" did not match "(clang version)":
clang-15: error: no input files
Checking whether the CUDA compiler is NVIDIA using "" did not match "nvcc: NVIDIA \(R\) Cuda compiler driver":
clang-15: error: no input files
Checking whether the CUDA compiler is Clang using "" did not match "(clang version)":
clang-15: error: no input files
The platform is Arch Linux:
- clang 15.0.7-1
- cmake 3.25.3-1
- cuda 12.1.0-1
I don't know what the errors mean and where to start looking. Do you have any hints?