From 61e05210be63d10c21d7a4286f59dd0d0a0b7ffb Mon Sep 17 00:00:00 2001 From: John Doe Date: Tue, 10 Mar 2026 23:25:56 -0400 Subject: [PATCH] Added libgomp1 --- install/llamacpp-install.sh | 10 ++- plans/llamacpp-cpu-backend-fix.md | 101 ++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 plans/llamacpp-cpu-backend-fix.md diff --git a/install/llamacpp-install.sh b/install/llamacpp-install.sh index f02a3442a..e0643353f 100644 --- a/install/llamacpp-install.sh +++ b/install/llamacpp-install.sh @@ -20,7 +20,8 @@ $STD apt-get install -y \ vulkan-tools \ libvulkan1 \ mesa-vulkan-drivers \ - pciutils + pciutils \ + libgomp1 msg_ok "Installed Dependencies" # Create directories @@ -175,6 +176,13 @@ systemctl restart llamacpp ## Troubleshooting +If you see "no CPU backend found" error: +1. Ensure libgomp1 is installed: apt-get install -y libgomp1 +2. Verify CPU backend libraries load: ldd /opt/llamacpp/bin/libggml-cpu-haswell.so +3. Check all libraries are present: ls -la /opt/llamacpp/bin/libggml-*.so +4. Backend libraries MUST be in the same directory as the executable +5. See: https://github.com/ggml-org/llama.cpp/issues/17491 + If you see "no backends are loaded" error: 1. Backend libraries MUST be in the same directory as the executable 2. Check all libraries are present: ls -la /opt/llamacpp/bin/*.so diff --git a/plans/llamacpp-cpu-backend-fix.md b/plans/llamacpp-cpu-backend-fix.md new file mode 100644 index 000000000..f4b03fb4b --- /dev/null +++ b/plans/llamacpp-cpu-backend-fix.md @@ -0,0 +1,101 @@ +# Fix Plan: llama.cpp CPU Backend Missing + +## Problem Summary + +The llama.cpp service fails to start with the error: +``` +llama_model_load: error loading model: make_cpu_buft_list: no CPU backend found +``` + +## Root Cause Analysis + +### Initial Hypothesis (INCORRECT) +Initially suspected that CPU backend files were missing from the installation. + +### Actual Root Cause (CONFIRMED) +The CPU backend files **ARE present** in `/opt/llamacpp/bin/`, but they fail to load due to a **missing dependency**: + +``` +$ ldd /opt/llamacpp/bin/libggml-cpu-haswell.so + libgomp.so.1 => not found <-- MISSING! +``` + +**`libgomp.so.1`** (GNU OpenMP runtime library) is required by the CPU backend libraries but is not installed in the container. + +### Why RPC and Vulkan Backends Load Successfully +- `libggml-rpc.so` - No `libgomp` dependency ✅ +- `libggml-vulkan.so` - No `libgomp` dependency ✅ +- `libggml-cpu-*.so` - **Requires `libgomp.so.1`** ❌ + +## Solution + +### Fix: Install libgomp1 Package + +Add `libgomp1` to the dependencies in [`install/llamacpp-install.sh`](install/llamacpp-install.sh): + +```bash +msg_info "Installing Dependencies" +$STD apt-get install -y \ + curl \ + wget \ + ca-certificates \ + vulkan-tools \ + libvulkan1 \ + mesa-vulkan-drivers \ + pciutils \ + libgomp1 # <-- Add this package +msg_ok "Installed Dependencies" +``` + +### Why This Works +- `libgomp1` provides `libgomp.so.1` (GNU OpenMP runtime) +- CPU backends use OpenMP for parallel processing +- Without this library, the dynamic linker fails to load `libggml-cpu-*.so` + +## Verification Steps + +After installing `libgomp1`, verify the fix: + +```bash +# 1. Verify libgomp is installed +ldd /opt/llamacpp/bin/libggml-cpu-haswell.so | grep gomp +# Expected: libgomp.so.1 => /lib/x86_64-linux-gnu/libgomp.so.1 (0x...) + +# 2. Verify CPU backend loads +/opt/llamacpp/bin/llama-server --version +# Expected output should include: +# load_backend: loaded RPC backend from ... +# load_backend: loaded Vulkan backend from ... +# load_backend: loaded CPU backend from .../libggml-cpu-*.so <-- This should now appear + +# 3. Test model loading +systemctl start llamacpp +journalctl -u llamacpp -f +# Should no longer show "no CPU backend found" error +``` + +## Implementation + +### File to Modify +[`install/llamacpp-install.sh`](install/llamacpp-install.sh) - Line 16-23 + +### Change Required +```diff + msg_info "Installing Dependencies" + $STD apt-get install -y \ + curl \ + wget \ + ca-certificates \ + vulkan-tools \ + libvulkan1 \ + mesa-vulkan-drivers \ + pciutils \ ++ libgomp1 + msg_ok "Installed Dependencies" +``` + +## References + +- [GitHub Issue #17491: CPU backend loader does not respect LD_LIBRARY_PATH](https://github.com/ggml-org/llama.cpp/issues/17491) +- [GitHub Issue #14691: make_cpu_buft_list: no CPU backend found](https://github.com/ggml-org/llama.cpp/issues/14691) +- [GNU OpenMP (libgomp) Documentation](https://gcc.gnu.org/onlinedocs/libgomp/)