--- name: llamacpp-prism-fork-rebuild-swap description: "Rebuild the PrismML llama.cpp fork on Dankclaw from origin/prism and swap frank-zealot's LLAMA_BIN onto it, including the gcc-13 host-compiler and install-RPATH requirements." --- Rebuild the PrismML llama.cpp fork on Dankclaw and swap `frank-zealot` onto it, without guessing the build flags. ## Recover the build configuration first The binary dir carries no CMakeCache. The configure that produced the running build lives in the source tree: ```bash grep -E 'GGML_CUDA|CUDA_ARCH|BUILD_TYPE|SHARED|HOST_COMPILER|FA_QUANTS|GENERATOR' \ /home/dank/GitPackages/llama-prism-src/build-*/CMakeCache.txt ``` The pinned source clone is `/home/dank/GitPackages/llama-prism-src`, branch `prism`, remote `https://github.com/PrismML-Eng/llama.cpp.git`. `origin/HEAD -> origin/prism`; there is no `master`/`main`. ## Build into a fresh worktree at a pinned commit ```bash SHA=$(git -C /home/dank/GitPackages/llama-prism-src rev-parse origin/prism) git -C /home/dank/GitPackages/llama-prism-src worktree add --detach /home/dank/GitPackages/llama-prism-next "$SHA" cmake -B .../llama-prism-next/build-cuda -S .../llama-prism-next -G Ninja \ -DCMAKE_BUILD_TYPE=Release -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=86-real \ -DCMAKE_CUDA_HOST_COMPILER=/usr/bin/gcc-13 -DLLAMA_CURL=OFF -DGGML_NATIVE=ON \ -DCMAKE_INSTALL_PREFIX=/home/dank/GitPackages/llama-prism- \ -DCMAKE_INSTALL_RPATH='$ORIGIN;$ORIGIN/../lib' cmake --build .../build-cuda -j 8 cmake --install .../build-cuda ``` - **`CMAKE_CUDA_HOST_COMPILER=/usr/bin/gcc-13` is mandatory**: the box default is gcc 15 and nvcc 12.4 rejects it. - **`CMAKE_INSTALL_RPATH` is mandatory**: `cmake --install` strips the build-tree rpath, and the installed binary then dies on `libllama-server-impl.so`. `patchelf` is NOT installed, so there is no post-hoc fix. - 672 targets on the first full build; run it detached (`setsid nohup … > log`) and keep `-j 8` so the co-tenant services stay usable. - Disk: the box runs ~84% full; check `df -h /home/dank` before starting. ## Verify the payload gate BEFORE swapping ```bash D=/home/dank/GitPackages/llama-prism- $D/bin/llama-server --version # expect 0.x.y-dev (build N, commit ) ldd $D/bin/llama-server | grep -c "not found" # must be 0 strings $D/lib/libggml-base.so.* | grep -c PQ2_0 # custom tensor type 142 strings $D/lib/libllama.so.* | grep -c prism.hadamard # dequant metadata ``` A fork that dropped either cannot load `Ternary-Bonsai-2-9B PQ2_0` — stock llama.cpp refuses the file and a loader ignoring the metadata dequantizes wrong, silently. ## Swap 1. `scripts/frank-zealot.env`: `LLAMA_BIN=/bin/llama-server` (install layout is `bin/`+`lib/`, not the flat dir older builds shipped — the old path `/llama-server` no longer exists). 2. Update the build/version in the env header and `serve-frank-zealot.sh` (default + comments). 3. Land on `main` from the canonical checkout, then `./scripts/deploy.sh dankclaw --service frank-zealot`. 4. Prove it: process arg0 is the new path, and the journal shows `- type pq2_0: N tensors`, `load_tensors_hadamard: loaded N Hadamard-folded weight(s)`, the adapter's `prism.abliterate.base_gguf` line, and `draft acceptance` once MTP drafts. Then probes: chat, a `tools` turn returning valid JSON `tool_calls`, and vision (solid-colour PNG via the OpenAI `image_url` content part, `max_tokens` ≥512 — thinking tokens count against it). 5. Rollback: point `LLAMA_BIN` back at the previous `llama-prism-b` dir and redeploy. Keep that dir on disk. ## Test seam `tests/frank_zealot_unit.bats` asserts `LLAMA_BIN` names a `llama-prism-*` **fork family** path, not a literal build directory: the suite runs on a box with no `/home/dank`, so existence cannot be checked there either. Do not re-pin a literal path.