bugfix: fix protobuf header shadowing by torch in DeepSeek V4 cpp chat template build.#75
Conversation
…t template build. Torch ships protobuf 3.13 headers; adding torch via a plain -I let them shadow vcpkg's protobuf 3.21 headers that the generated .pb.h files require, breaking the NPU build. Pass torch include dirs with -idirafter so they sit at the end of the search path, letting <google/protobuf/...> resolve to vcpkg's copy. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request modifies xllm_service/chat_template/CMakeLists.txt to prevent Torch's bundled protobuf headers from shadowing vcpkg's protobuf headers by using the -idirafter compiler option instead of standard include directories. The review feedback correctly points out that -idirafter is compiler-specific (GCC/Clang) and suggests guarding this logic with a compiler check to prevent build failures on other compilers like MSVC.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Description
Torch ships protobuf 3.13 headers; adding torch via a plain -I let them shadow vcpkg's protobuf 3.21 headers that the generated .pb.h files require, breaking the NPU build. Pass torch include dirs with -idirafter so they sit at the end of the search path, letting <google/protobuf/...> resolve to vcpkg's copy.