Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

CMake error on CUDA toolkit

📅 2014-May-29 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ cmake, cuda, error ⬩ 📚 Archive

Problem

I installed CUDA using this command:

$ sudo apt install nvidia-cuda-dev

I tried to compile a CUDA program using CMake and got this error:

CMake Error at /usr/share/cmake/Modules/FindCUDA.cmake:488 (message):
  Specify CUDA_TOOLKIT_ROOT_DIR
Call Stack (most recent call first):
  CMakeLists.txt:20 (find_package)

Solution

Turns out that nvidia-cuda-dev does not install the CUDA toolkit or SDK. Though it is named like a development package in Linux typically is, it is not.

To install the CUDA toolkit use:

$ sudo apt install nvidia-cuda-toolkit

The CMake compile error went away after this :)

Tried with: CUDA 5.5, CMake 2.8.12.2 and Ubuntu 14.04


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧