Skip to content

Commit ed648b3

Browse files
authored
fix(llama-cpp): include server-chat.cpp in grpc-server translation unit (#9511)
* fix(llama-cpp): include server-chat.cpp in grpc-server translation unit Upstream llama.cpp refactor (ggml-org/llama.cpp#20690) moved the OAI/Anthropic/Responses and transcription conversion helpers out of server-common.cpp into a new server-chat.cpp, and server-task.cpp and server-context.cpp now call those symbols (convert_transcriptions_to_chatcmpl, server_chat_convert_responses_to_chatcmpl, server_chat_convert_anthropic_to_oai, server_chat_msg_diff_to_json_oaicompat) via server-chat.h. grpc-server.cpp builds as a single translation unit by #include-ing the upstream .cpp files directly. Without including server-chat.cpp, the declarations are satisfied at compile time via server-chat.h but the link step fails with undefined references once LLAMA_VERSION crosses the refactor commit (134d6e54). Guard the include with __has_include so the same source stays buildable on older LLAMA_VERSION pins that predate the refactor (where prepare.sh won't copy server-chat.cpp into tools/grpc-server/). Assisted-by: Claude:claude-opus-4-7 [Claude Code] Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * chore(llama-cpp): bump LLAMA_VERSION to 0d0764dfd Bump to ggml-org/llama.cpp@0d0764d. Paired with the preceding grpc-server server-chat.cpp include so the refactor at 134d6e54 links cleanly. Supersedes PR #9494. Assisted-by: Claude:claude-opus-4-7 [Claude Code] Signed-off-by: Ettore Di Giacinto <mudler@localai.io> --------- Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
1 parent 3ce5248 commit ed648b3

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

backend/cpp/llama-cpp/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
LLAMA_VERSION?=5a4cd6741fc33227cdacb329f355ab21f8481de2
2+
LLAMA_VERSION?=0d0764dfd257c0ae862525c05778207f87b99b1c
33
LLAMA_REPO?=https://github.com/ggerganov/llama.cpp
44

55
CMAKE_ARGS?=

backend/cpp/llama-cpp/grpc-server.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
#include "server-task.cpp"
1111
#include "server-queue.cpp"
1212
#include "server-common.cpp"
13+
// server-chat.cpp exists only in llama.cpp after the upstream refactor that
14+
// split OAI/Anthropic/Responses/transcription conversion helpers out of
15+
// server-common.cpp. When present, server-context.cpp and server-task.cpp
16+
// above call into it, so we must pull its definitions into this TU or the
17+
// link fails. __has_include keeps the source compatible with older pins.
18+
#if __has_include("server-chat.cpp")
19+
#include "server-chat.cpp"
20+
#endif
1321
#include "server-context.cpp"
1422

1523
// LocalAI

0 commit comments

Comments
 (0)