You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
d222767 (b10630)
Still present on master as of 2026-08-31 (target_include_directories(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR}/ggml/src/ggml-metal) in tools/tuning/CMakeLists.txt).
Operating systems
Linux
Mac
Windows
BSD
Other? (Please let us know in description)
(Only tested on Mac, but the root cause is platform-independent: any FetchContent/add_subdirectory consumer.)
GGML backends
BLAS
CPU
Metal
(Minimal reproducer below only sets -DGGML_METAL=ON; CPU and Accelerate/BLAS defaults apply on macOS. The failure is in the tools/tuning executable target itself, not in a backend.)
Problem description & steps to reproduce
tools/tuning/CMakeLists.txt (added in #26570) resolves its include directory relative to the outermost CMake project:
FetchContent consumer: CMAKE_SOURCE_DIR == the consumer's top-level source dir → the include path does not exist → fa-vec.cpp fails with fatal error: 'ggml-metal-tuning.h' file not found (the header itself is checked in at ggml/src/ggml-metal/, so only the include path is wrong).
Minimal reproducer (llama.cpp b10630, macOS):
mkdir repro && cd repro
cat > CMakeLists.txt <<'CMAKE'
cmake_minimum_required(VERSION 3.16)
project(consumer C CXX)
include(FetchContent)
set(LLAMA_BUILD_COMMON ON CACHE BOOL "" FORCE)
set(LLAMA_BUILD_TOOLS ON CACHE BOOL "" FORCE)
set(LLAMA_BUILD_SERVER OFF CACHE BOOL "" FORCE)
set(LLAMA_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(LLAMA_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
FetchContent_Declare(llama_cpp
GIT_REPOSITORY https://github.com/ggml-org/llama.cpp.git
GIT_TAG d222767c7a6516559a3f49e7721b6c6b1acc87b4)
FetchContent_MakeAvailable(llama_cpp)
CMAKE
cmake -S . -B build -DGGML_METAL=ON
cmake --build build -j
Notes:
All three conditions are required: FetchContent (subproject) context, LLAMA_BUILD_TOOLS=ON, GGML_METAL=ON. FetchContent sets LLAMA_STANDALONE=OFF, so tools must be forced on, and tools/CMakeLists.txt only adds the target via if (GGML_METAL) add_subdirectory(tuning) — consumers that fetch llama.cpp with Metal disabled don't hit this.
LLAMA_BUILD_TOOLS=OFF is not a workaround for consumers that need llama.cpp's tools targets (ollama installs llama.cpp's llama-server/llama-quantize).
Git commit
d222767 (b10630)
Still present on master as of 2026-08-31 (
target_include_directories(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR}/ggml/src/ggml-metal)intools/tuning/CMakeLists.txt).Operating systems
(Only tested on Mac, but the root cause is platform-independent: any FetchContent/add_subdirectory consumer.)
GGML backends
(Minimal reproducer below only sets
-DGGML_METAL=ON; CPU and Accelerate/BLAS defaults apply on macOS. The failure is in thetools/tuningexecutable target itself, not in a backend.)Problem description & steps to reproduce
tools/tuning/CMakeLists.txt(added in #26570) resolves its include directory relative to the outermost CMake project:CMAKE_SOURCE_DIR== llama.cpp repo root → works.CMAKE_SOURCE_DIR== the consumer's top-level source dir → the include path does not exist →fa-vec.cppfails withfatal error: 'ggml-metal-tuning.h' file not found(the header itself is checked in atggml/src/ggml-metal/, so only the include path is wrong).Minimal reproducer (llama.cpp b10630, macOS):
Notes:
LLAMA_BUILD_TOOLS=ON,GGML_METAL=ON. FetchContent setsLLAMA_STANDALONE=OFF, so tools must be forced on, andtools/CMakeLists.txtonly adds the target viaif (GGML_METAL) add_subdirectory(tuning)— consumers that fetch llama.cpp with Metal disabled don't hit this.LLAMA_BUILD_TOOLS=OFFis not a workaround for consumers that need llama.cpp's tools targets (ollama installs llama.cpp'sllama-server/llama-quantize).inreplacefor this: ollama 0.33.2 Homebrew/homebrew-core#301407Suggested fix (one line):
Verified locally with this patch applied:
ggml-metal-tuningtarget links.llama/server(FetchContent,--preset darwin) against the patched tree: configure, build andcmake --install --component llama-serverall pass;llama-server --versionreportsbuild 10630, commit d222767c7.First Bad Commit
f280b26 — #26570 (only commit touching
tools/tuning/CMakeLists.txt)Compile command
Minimal reproducer (see above):
Consumer variant (ollama v0.33.2
llama/serverpreset):Relevant log output