I am on Fedora 40 and installed the CUDA toolkit using these commands:
sudo dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/fedora39/x86_64/cuda-fedora39.repo
sudo dnf clean all
sudo dnf module disable nvidia-driver
sudo dnf -y install cuda
Everything seemed ok:
I created a simple test CMake project and even specified the root explicitly:
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
set(CUDAToolkit_ROOT "/usr/local/cuda")
# Set the project name and enable CUDA
project(biNRC LANGUAGES CXX CUDA)
# Add the executable
add_executable(${PROJECT_NAME} main.cu)
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20 cuda_std_20)
# Set the properties for the CUDA target
set_target_properties(${PROJECT_NAME} PROPERTIES
CUDA_SEPARABLE_COMPILATION ON
CUDA_STANDARD_REQUIRED ON
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
)
Still I get this error which I absolutely do not understand:
[main] Configuring project: binrc
[proc] Executing command: /usr/bin/cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE --no-warn-unused-cli -S/home/julcs/Documents/binrc -B/home/julcs/Documents/binrc/build
[cmake] CMake Error at /usr/share/cmake-3.30/Modules/Internal/CMakeCUDAFindToolkit.cmake:37 (message):
[cmake] Could not find nvcc executable in path specified by
[cmake] CUDAToolkit_ROOT=/usr/local/cuda-12.6
[cmake] Call Stack (most recent call first):
[cmake] /usr/share/cmake-3.30/Modules/CMakeDetermineCUDACompiler.cmake:85 (cmake_cuda_find_toolkit)
[cmake] CMakeLists.txt:6 (project)
[cmake]
[cmake]
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Configuring incomplete, errors occurred!
[proc] The command: /usr/bin/cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE --no-warn-unused-cli -S/home/julcs/Documents/binrc -B/home/julcs/Documents/binrc/build exited with code: 1
How can this be CUDA is clearly there in the right location with nvcc in bin/. Any help appreciated thanks in advance.
Oh I had the flatpak version of VSCode that was the error