Not Locating CUDA Compiler Follow
I have a project that I am just starting to use CLion on. The existing CMakeLists.txt file contains the following lines:
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(myProj LANGUAGES C CXX CUDA)
I have the Cuda 8.0 dev tools installed. Loading the CMake project from within CLion gives the following error:
/home/ubuntu/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/181.4668.70/bin/cmake/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /home/ubuntu/myProj
CMake Error at CMakeLists.txt:2 (project):
No CMAKE_CUDA_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CUDACXX" or the CMake cache entry CMAKE_CUDA_COMPILER to the full
path to the compiler, or to the compiler name if it is in the PATH.
But cuda and its compiler, nvcc, is installed and in the path. I can bring up a terminal (bash) window from within CLion and run the Cuda compiler:
$ which nvcc
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Sun_Sep__4_22:14:01_CDT_2016
Cuda compilation tools, release 8.0, V8.0.44
I've tried setting CUDA_CXX in the environment to the full path of the nvcc compiler, the path of the directory it resides in, just "nvcc", no improvement.
I *CAN* get it to work by adding:
to the CMakeLists.txt file, but other people need to be able to build this project, including our automated build system, where the path to the nvcc compiler might be different, so I don't want a hard-coded path in the make file.
Running cmake from outside CLion, as in:
$ cmake ..
also works fine WITHOUT setting CMAKE_CUDA_COMPILER in the CMakeLists.txt file. One difference here is that the cmake in my search path is version 3.11.1, whereas the cmake version CLion is using is 3.10.3, but I know that isn't the issue because:
$ /home/ubuntu/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/181.4668.70/bin/cmake/bin/cmake ..
also works fine.
Why isn't the CLion CMake able to find the Cuda compiler?
Thanks in advance.
Build #CL-181.4668.70, built on April 24, 2018
JRE: 1.8.0_152-release-1136-b29 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Please sign in to leave a comment.
I made it work by doing exactly what the error message suggests you to do, that is by setting the CUDACXX (without underscore) environmental variable pointing to the nvcc executable (under Settings -> Build, Execution, Deployment -> CMake )
Over a year had gone by, this issue is till there.
Bug reported here: https://youtrack.jetbrains.com/issue/CPP-17175
I met the same problem in Windows10 environment, it might be caused by not installing CUDA on default location ,and I fixed it by doing the same thing as @Francesco Seccamonte said, it is notabale that you should config the 'CMake options' in 'Settings -> Build, Execution, Deployment -> CMake' like this:
-DCMAKE_CUDA_COMPILER:PATH= (path to your cuda location)\bin\nvcc.exe
Just in case, here is the same instruction in our web help - https://www.jetbrains.com/help/clion/cuda-projects.html#set-nvcc.