Route C detail: bare Ubuntu, where the flags matter
Route C is the auditable one: bare Ubuntu 26.04, ROCm 7.2.2 from AMD's own repositories, llama.cpp compiled by you for your exact GPUs. No third-party binaries, no bridges, no overrides. On a dedicated inference box this is the most stable and easiest-to-debug route.
Step 1 — purge until the slate is clean
On a fresh or previously-broken ROCm install, order matters. Purge everything first:
sudo apt purge -y amdgpu-install amdgpu-dkms rocm-dev rocm-libs sudo apt purge -y "rocm-*" "librocm-*" rocminfo sudo apt autoremove -y sudo rm -rf /opt/rocm /opt/rocm* sudo rm -f /etc/apt/sources.list.d/rocm.list /etc/apt/sources.list.d/graphics*.list sudo apt update
The success condition is blunt: dkms status must print nothing. If it prints anything, you have not purged cleanly — go back.
Step 2 — install ROCm 7.2.2 and pin AMD's repos
# download the amdgpu-install .deb for your Ubuntu release from # https://repo.radeon.com/amdgpu-install/ (the latest/ubuntu/<release>/ path; # my June 2026 notes used the 7.2.3.70204 deb from the noble path) sudo apt install ./amdgpu-install_<version>_all.deb sudo amdgpu-install --accept-eula --usecase=graphics,rocm
Then register AMD's repositories — the ROCm apt repo plus the graphics repo — pinned at priority 600 so AMD's packages win over Ubuntu's stock ones. I chose this install without the dkms kernel driver; whether your graphics stack needs it is an AMD-current-docs question, not a question this dated note can answer.
Step 3 — build llama.cpp for your exact GPU
The flag set I use, tested on two different cards:
cmake -B build \ -DGGML_HIP=ON -DGGML_HIPBLAS=ON -DGGML_HIP_UMA=ON \ -DGGML_HIP_ROCWMMA_FATTN=OFF \ -DCMAKE_BUILD_TYPE=Release \ -DAMDGPU_TARGETS=gfx1103 # Radeon 760M; use gfx1200 for RX 9070 cmake --build build -j $(nproc) ./build/bin/llama-cli --version
Wrong target, wrong failure. The only real skill in this route is the AMDGPU_TARGETS line: gfx1103 for the RDNA 3 integrated GPU, gfx1200 for RDNA 4.
Three notes from the trenches
- libxml2. The build wants
libxml2.so.2and the distro ships a soname it does not provide. Installlibxml2-devand link it:sudo ln -s /usr/lib/x86_64-linux-gnu/libxml2.so /usr/lib/x86_64-linux-gnu/libxml2.so.2 && sudo ldconfig. - Do not set
HSA_OVERRIDE_GFX_VERSIONon a card you compiled natively. My first runtime script exportedHSA_OVERRIDE_GFX_VERSION=11.0.0— copied from an old workaround — and the server core-dumped. The override exists to fake an older gfx target; on a card the build already targets, it only breaks things. - Uninstall cleanly.
sudo cmake --install builddrops files into/usr/local; the uninstall is the manifest:sudo xargs rm < build/install_manifest.txt. Keep the build directory.
What I did not verify
- The deb version (7.2.2.70202), the codename path (jammy) and the repo pinning are quoted from May–June 2026 notes; Ubuntu 26.04's own packaging has moved since. Check AMD's current install docs for your release before copying.
- No tok/s measurements for this route on my hardware — on a dedicated Linux box overhead should be minimal versus WSL, but benchmark your own box.
Honesty note. All steps above come from my dated notes (May–June 2026) on the hardware described (RX 9070, integrated Radeon 760M, Ubuntu 26.04). Machine names and addresses do not appear. Overview: The Three Routes That Actually Work. No affiliate links in this article.