Cake can't find nvcc. CUDAToolkit_ROOT environment variable must be set. Ubuntu/Pop_OS 21.10
Completed
I'm trying to run a cuda program in Clion. Whenever I load the CmakeList.txt, I get the following error in the terminal:
Failed to find nvcc. Compiler requires the CUDA toolkit. Please set the CUDAToolkit_ROOT variable.
I installed Cuda as described by system76's instructions and I can run nvcc in the terminal fine. Executing `which nvcc` in the terminal reveals the path of nvcc to be /usr/lib/cuda/bin/nvcc .
I set an enviroment variable called CUDAToolkit_ROOT to /usr/lib/cuda and /usr/lib/cuda-11.2 and then I get the the error for both environment variable configs: Could not find nvcc executable in path specified by environment variable CUDAToolkit_ROOT=/usr/lib/cuda
Any ideas on what I'm doing wrong?
Please sign in to leave a comment.
Hello!
Please delete the CUDAToolkit_ROOT enviroment variable, add /usr/local/cuda-<version>/bin to
PATH
in the /etc/environment configuration file and restart the machine (see https://www.jetbrains.com/help/clion/cuda-projects.html#set-nvcc). Does it help?Hello
I have done as you said, but cuda does not install to usr/local/ in Pop!_OS, like vanilla ubuntu, so instead of usr/local/cuda-<version>/bin, I edited the path variable to usr/lib/cuda-<version>/bin
As such my environment looks like:
with cuda-11.2 variable at the end. I rebooted, started a brand new Clion cuda executable, and got the same exact error message
Could you please try setting the
CMAKE_CUDA_COMPILER
variable to the location of the NVCC executable in File | Settings | Build, Execution, Deployment | CMake? See the second point here https://www.jetbrains.com/help/clion/cuda-projects.html#set-nvccHello I have done as instructed. I get the same error. This is my setup. I tried with and without " ":
I can compile fine doing a manual cmake and running make in the terminal so I know it's not cmake's problem. This is what my cuda paths look like:
Please send the following materials to clion-support at jetbrains.com:
Help | Collect Logs and Diagnostic Data
and send us the resulted archive. Note that logs might contain private user's information (like file paths and names).Tools | CMake | Reset Cache and Reload Project
and send us the entire output from the CMake tool window.