From 5627e950e80233784b4b5bf93cb9683800a38416 Mon Sep 17 00:00:00 2001 From: Cuiys Date: Tue, 23 Jun 2026 10:08:24 +0800 Subject: [PATCH] fix(python): only bundle the DiskANN plugin where it is supported (#510) --- .gitignore | 8 ++++++++ CMakeLists.txt | 11 ++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 38c769e..b2fd516 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,14 @@ dist html *.lcov.info +# Compiled extension modules must never live in the source package: they are +# built by CMake and installed into the wheel. A stray copy left here gets +# bundled verbatim by scikit-build's wheel.packages and breaks the wheel +# (e.g. a stale binary with the wrong macOS deployment target). +python/zvec/*.so +python/zvec/*.dylib +python/zvec/*.pyd + # Dependencies /node_modules diff --git a/CMakeLists.txt b/CMakeLists.txt index 25760ab..708bac7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -183,9 +183,14 @@ if(BUILD_PYTHON_BINDINGS) # function. The Python extension resolves the module next to _zvec.so # (see the $ORIGIN rpath in src/binding/python/CMakeLists.txt); the # module must therefore be installed alongside _zvec.so in the wheel. - # The target exists only on platforms where DiskAnn is buildable - # (currently Linux x86_64 with libaio). - if(TARGET core_knn_diskann) + # + # Gate on DISKANN_SUPPORTED, not on the target's existence: on unsupported + # platforms (e.g. macOS / ARM64) the core_knn_diskann target is still + # defined, but built from an empty stub (src/core/algorithm/CMakeLists.txt) + # with zero exported symbols and a runtime load path compiled out + # (#if DISKANN_SUPPORTED). Shipping that stub is pure dead weight, so it is + # only packaged where DiskAnn is real — currently Linux x86_64 with libaio. + if(DISKANN_SUPPORTED) install(TARGETS core_knn_diskann LIBRARY DESTINATION ${ZVEC_PY_INSTALL_DIR} COMPONENT python) endif()