This script builds the llama.cpp binaries with CUDA support.
It follows the official llama.cpp build guide, while using a Conda managed CUDA toolchain for the Linux setup here:
https://github.com/ggml-org/llama.cpp/blob/master/docs/build.md
Conda is required and must be available in your PATH before running this script.
If you do not already have Conda installed, follow the install instructions from Miniforge:
https://github.com/conda-forge/miniforge
Ubuntu 26.04, at the time of writing, only provides CUDA 13.1 through its APT repositories, which caused build issues for llama.cpp, including:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h: error:
exception specification is incompatible with that of previous function "rsqrt"
exception specification is incompatible with that of previous function "rsqrtf"
This script avoids that system CUDA setup by using Conda to install cuda-toolkit=13.2 in an isolated environment.
bash build-llama-cpp-cuda.shThe script will:
- clone or update
llama.cpp - create a Conda environment named
llama-cpp-cuda132 - install CUDA 13.2,
cmake, and a C++ compiler - build
llama.cppwithGGML_CUDA=ON
Build output:
./llama.cpp/build/bin