llama.cpp build fails: nvcc not found
Cause
Building llama.cpp with CUDA requires the full CUDA Toolkit (nvcc compiler), not just the GPU driver. The driver alone is enough to RUN CUDA programs, but you need the toolkit to COMPILE them.
Solution
Check if nvcc exists:
which nvcc
nvcc --version
Install the CUDA Toolkit:
Linux (Ubuntu):
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt update && sudo apt install cuda-toolkit-12-6
Then add to PATH:
echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
Windows: Install the CUDA Toolkit installer from developer.nvidia.com/cuda-downloads. Use the visual studio integration option. Open the "x64 Native Tools Command Prompt for VS" — nvcc will be on PATH there.
Build llama.cpp:
make clean
GGML_CUDA=1 make -j
Skip CUDA if you don't actually need it (CPU-only build is fast and works):
make -j
Did this fix it?
If your case was different, email hello@runlocalai.co with what you saw and we'll update the page. If it worked but took different commands on your platform, we want to know that too.