Build / compile failures
llama.cpp CUDA build: unsupported GNU version! gcc versions later than X are not supported
error: unsupported GNU version! gcc versions later than 13 are not supported
By Fredoline Eruo · Last verified May 8, 2026
Cause
Each CUDA toolkit version supports a bounded range of host compilers. CUDA 12.4 supports gcc up to 13; CUDA 12.6 supports up to 14. Modern distros (Ubuntu 24.04, Fedora 40) ship gcc 14 by default, which fails against an older CUDA toolkit.
Solution
1. Install a supported gcc version side-by-side:
# Ubuntu
sudo apt install gcc-12 g++-12
# Fedora
sudo dnf install gcc-toolset-12
2. Point the build at it:
# CMake
cmake -B build -DGGML_CUDA=ON \
-DCMAKE_C_COMPILER=gcc-12 \
-DCMAKE_CXX_COMPILER=g++-12 \
-DCMAKE_CUDA_HOST_COMPILER=g++-12
# Make
make GGML_CUDA=1 \
CC=gcc-12 CXX=g++-12 \
NVCCFLAGS="-ccbin g++-12" -j
3. Or update CUDA to a newer toolkit that supports your default gcc. CUDA 12.6+ supports gcc 14.
4. Quick override if you don't want to change the system gcc:
export NVCC_PREPEND_FLAGS='-allow-unsupported-compiler'
This is a hack — works often, fails on subtle ABI incompatibilities. Prefer a real fix.
Related errors
Did this fix it?
If your case was different, email support@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.