Skip to content

Commit 94cb08a

Browse files
cmake: skip x86 cpu-feats helper in hybrid GGML_BACKEND_DL + GGML_CPU_STATIC builds
The cpu-feats OBJECT library implements the DL loader's variant score; it is meaningful only when the CPU backend itself is a dlopen'd module. In hybrid mode (GGML_BACKEND_DL=ON + GGML_CPU_STATIC=ON - the qvac diffusion port configuration) the CPU backend is a static library registered directly in-process, and PRIVATE-linking the un-exported OBJECT helper into it makes configure fail at install(EXPORT ggml-targets): includes target "ggml-cpu" which requires target "ggml-cpu-feats" that is not in any export set. ARM never hit this because its feats call is gated on GGML_CPU_ALL_VARIANTS; x86 gated it on GGML_BACKEND_DL alone. Needed to extend the Android hybrid mode to desktop Linux (QVAC-23767 / qvac#3853).
1 parent f31dab0 commit 94cb08a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/ggml-cpu/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,15 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
387387
endif()
388388
endif()
389389

390-
if (GGML_BACKEND_DL)
390+
# The cpu-feats score object only matters when the CPU backend is a
391+
# dlopen'd module that must score itself against the host CPU. In
392+
# hybrid mode (GGML_BACKEND_DL + GGML_CPU_STATIC) the CPU backend is a
393+
# static library registered directly in-process, the score is never
394+
# consulted, and the OBJECT helper breaks install(EXPORT ggml-targets)
395+
# ("requires target ggml-cpu-feats that is not in any export set").
396+
# ARM already skips it implicitly (feats is only added under
397+
# GGML_CPU_ALL_VARIANTS there).
398+
if (GGML_BACKEND_DL AND NOT GGML_CPU_STATIC)
391399
if (GGML_NATIVE)
392400
# the feature check relies on ARCH_DEFINITIONS, but it is not set with GGML_NATIVE
393401
message(FATAL_ERROR "GGML_NATIVE is not compatible with GGML_BACKEND_DL, consider using GGML_CPU_ALL_VARIANTS")

0 commit comments

Comments
 (0)