Skip to content

Commit f15e692

Browse files
committed
fix(python): only bundle the DiskANN plugin where it is supported
The wheel install rule for the DiskANN plugin was gated on `if(TARGET core_knn_diskann)`. That target always exists: on platforms where DiskAnn is unsupported (macOS, ARM64, ...) it is built from an empty stub (src/core/algorithm/CMakeLists.txt) with zero exported symbols, and the runtime load path is compiled out via `#if DISKANN_SUPPORTED`. So the condition was always true and a useless ~16 KB stub `.dylib` was shipped in every non-Linux-x86_64 wheel. Gate the install on `DISKANN_SUPPORTED` instead, so the plugin is packaged only where it is real (currently Linux x86_64 with libaio). Verified on macOS arm64: `libcore_knn_diskann.dylib` no longer appears in the wheel; `import zvec` and other index types are unaffected.
1 parent 0ac294a commit f15e692

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,14 @@ if(BUILD_PYTHON_BINDINGS)
179179
# function. The Python extension resolves the module next to _zvec.so
180180
# (see the $ORIGIN rpath in src/binding/python/CMakeLists.txt); the
181181
# module must therefore be installed alongside _zvec.so in the wheel.
182-
# The target exists only on platforms where DiskAnn is buildable
183-
# (currently Linux x86_64 with libaio).
184-
if(TARGET core_knn_diskann)
182+
#
183+
# Gate on DISKANN_SUPPORTED, not on the target's existence: on unsupported
184+
# platforms (e.g. macOS / ARM64) the core_knn_diskann target is still
185+
# defined, but built from an empty stub (src/core/algorithm/CMakeLists.txt)
186+
# with zero exported symbols and a runtime load path compiled out
187+
# (#if DISKANN_SUPPORTED). Shipping that stub is pure dead weight, so it is
188+
# only packaged where DiskAnn is real — currently Linux x86_64 with libaio.
189+
if(DISKANN_SUPPORTED)
185190
install(TARGETS core_knn_diskann LIBRARY DESTINATION ${ZVEC_PY_INSTALL_DIR})
186191
endif()
187192
# Bundle cppjieba's dictionary files so the `jieba` FTS tokenizer works

0 commit comments

Comments
 (0)