From 266d996cfa9bf923c0cefee7d5bac4d654fde36d Mon Sep 17 00:00:00 2001 From: mudler <2420543+mudler@users.noreply.github.com> Date: Tue, 1 Sep 2026 20:17:09 +0000 Subject: [PATCH 1/2] :arrow_up: Update ggml-org/llama.cpp Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- backend/cpp/llama-cpp/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/cpp/llama-cpp/Makefile b/backend/cpp/llama-cpp/Makefile index b1f34d9852ac..e78be7b0d15c 100644 --- a/backend/cpp/llama-cpp/Makefile +++ b/backend/cpp/llama-cpp/Makefile @@ -1,5 +1,5 @@ -LLAMA_VERSION?=d7bd3bfcad3e29c7e49fd26f38c79ee3e9a3fd6b +LLAMA_VERSION?=3466812d1f06728effe7c0f3c0671117f461672d LLAMA_REPO?=https://github.com/ggerganov/llama.cpp CMAKE_ARGS?= From d369e9ff1e64a87f2688e3a9fd64d3bfde38a398 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Tue, 1 Sep 2026 15:44:11 +0000 Subject: [PATCH 2/2] fix(llama-cpp): link librdma from the static ggml-rpc build ggml-rpc gained an Apple RDMA transport in this llama.cpp range and declares its librdma dependency with target_link_options(ggml-rpc PRIVATE "LINKER:-weak_library,..."). Link options are not a usage requirement of a static library, so the llama-cpp-grpc variant, which builds with BUILD_SHARED_LIBS=OFF, dropped the flag and left every ibv_* symbol of transport-apple.cpp undefined when grpc-server linked on darwin. prepare.sh now re-declares the same weak link as INTERFACE on the ggml-rpc target, so the flag reaches whoever links the static library. The append is guarded on a marker for repeat runs, and on GGML_RPC_RDMA_APPLE, which the turboquant and bonsai forks lack. Assisted-by: Claude:claude-opus-5 [Claude Code] Signed-off-by: Ettore Di Giacinto --- backend/cpp/llama-cpp/prepare.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/backend/cpp/llama-cpp/prepare.sh b/backend/cpp/llama-cpp/prepare.sh index e00b139cb1c6..c76d15bb79a2 100644 --- a/backend/cpp/llama-cpp/prepare.sh +++ b/backend/cpp/llama-cpp/prepare.sh @@ -15,6 +15,30 @@ if [ -d "patches" ]; then done fi +## Apple RDMA link fixup. + +## ggml-rpc hands Apple's librdma to the linker with +## target_link_options(ggml-rpc PRIVATE "LINKER:-weak_library,..."). Link options are not +## a usage requirement of a static library, so in our BUILD_SHARED_LIBS=OFF build the flag +## dies with libggml-rpc.a and every ibv_* symbol transport-apple.cpp reaches for comes out +## undefined when grpc-server and ggml-rpc-server link. Re-declare the same weak link as +## INTERFACE so it travels to whoever links the static library. +## +## Guarded on the marker so a second prepare.sh over the same checkout is a no-op, and on +## GGML_RPC_RDMA_APPLE so forks that branched before the Apple RDMA transport (turboquant, +## bonsai) are left alone. +RPC_CMAKE=llama.cpp/ggml/src/ggml-rpc/CMakeLists.txt +if [ -f "$RPC_CMAKE" ] && grep -q "GGML_RPC_RDMA_APPLE" "$RPC_CMAKE" && ! grep -q "LOCALAI_RDMA_IFACE" "$RPC_CMAKE"; then + echo "==> ggml-rpc carries the Apple RDMA transport, re-declaring its weak librdma link as INTERFACE" + cat >> "$RPC_CMAKE" <<'EOF' + +# LOCALAI_RDMA_IFACE: added by backend/cpp/llama-cpp/prepare.sh +if (GGML_RPC_RDMA AND APPLE AND NOT BUILD_SHARED_LIBS) + target_link_options(ggml-rpc INTERFACE "LINKER:-weak_library,${RDMA_LIB}") +endif() +EOF +fi + for file in $(ls llama.cpp/tools/server/); do cp -rfv llama.cpp/tools/server/$file llama.cpp/tools/grpc-server/ done