Skip to content

Commit ce87b59

Browse files
authored
Fix build errors when WIRH_CARDINAL=true (#1624)
Signed-off-by: yhmo <yihua.mo@zilliz.com>
1 parent c55ad73 commit ce87b59

4 files changed

Lines changed: 21 additions & 7 deletions

File tree

Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ WITH_BENCHMARK ?=
2727
WITH_ASAN ?=
2828
WITH_SVS ?=
2929
WITH_CARDINAL ?=
30+
CARDINAL_VERSION_FORCE_CHECKOUT ?=
3031
WITH_DEBUG ?=
3132
CONAN_PROFILE ?=
3233

@@ -35,7 +36,7 @@ CONAN_PROFILE ?=
3536
# variables such as WITH_ASAN to every sub-process, which causes the custom
3637
# folly recipe to pick up $ENV{WITH_ASAN} and compile folly itself with
3738
# -fsanitize=address — breaking the build on GCC.
38-
unexport WITH_GPU WITH_UT WITH_BENCHMARK WITH_ASAN WITH_CARDINAL WITH_DEBUG
39+
unexport WITH_GPU WITH_UT WITH_BENCHMARK WITH_ASAN WITH_CARDINAL CARDINAL_VERSION_FORCE_CHECKOUT WITH_DEBUG
3940

4041
# ---------- Derived settings ----------
4142
ifdef WITH_DEBUG
@@ -92,6 +93,16 @@ ifdef WITH_CARDINAL
9293
CONAN_SETTINGS += -o \&:with_cardinal=True
9394
endif
9495

96+
ifneq ($(CARDINAL_VERSION_FORCE_CHECKOUT),)
97+
ifneq ($(filter True true ON on 1,$(CARDINAL_VERSION_FORCE_CHECKOUT)),)
98+
CONAN_SETTINGS += -o \&:cardinal_version_force_checkout=True
99+
else ifneq ($(filter False false OFF off 0,$(CARDINAL_VERSION_FORCE_CHECKOUT)),)
100+
CONAN_SETTINGS += -o \&:cardinal_version_force_checkout=False
101+
else
102+
$(error CARDINAL_VERSION_FORCE_CHECKOUT must be True/False, ON/OFF, or 1/0)
103+
endif
104+
endif
105+
95106
ifdef CONAN_PROFILE
96107
CONAN_SETTINGS += -pr $(CONAN_PROFILE)
97108
endif
@@ -160,6 +171,7 @@ help: ## Show available targets
160171
@echo " WITH_ASAN=True Enable AddressSanitizer"
161172
@echo " WITH_SVS=True Enable SVS (Intel Scalable Vector Search, x86 only)"
162173
@echo " WITH_CARDINAL=True Enable Cardinal build"
174+
@echo " CARDINAL_VERSION_FORCE_CHECKOUT=True Force Cardinal checkout to configured version"
163175
@echo " WITH_DEBUG=True Debug build (default: Release)"
164176
@echo " CONAN_PROFILE=<p> Use a custom Conan profile (e.g. clang, gcc-15)"
165177
@echo " LIBCXX=<lib> Override compiler.libcxx (auto-detected from OS)"

cmake/libs/cardinal/v1/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ project(knowhere CXX C)
33

44
# Use short SHA1 as version
55
# v2.5 tag is used for cardinal v1
6-
set(CARDINAL_VERSION v2.5.105)
6+
set(CARDINAL_VERSION v1_blas)
77
set(CARDINAL_REPO_URL "https://github.com/zilliztech/cardinal.git")
88

99
set(CARDINAL_ROOT "${KNOWHERE_THRID_ROOT}/cardinalv1")

cmake/libs/cardinal/v2/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ project(knowhere CXX C)
33

44
# Use short SHA1 as version
55
# v2.6 tag is used for cardinal v2
6-
set(CARDINAL_VERSION v3.0.1)
6+
set(CARDINAL_VERSION recipe)
77
set(CARDINAL_REPO_URL "https://github.com/zilliztech/cardinal.git")
88

99
set(CARDINAL_ROOT "${KNOWHERE_THRID_ROOT}/cardinalv2")

conanfile.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class KnowhereConan(ConanFile):
2828
"with_diskann": [True, False],
2929
"with_svs": [True, False],
3030
"with_cardinal": [True, False],
31+
"cardinal_version_force_checkout": [True, False],
3132
"with_profiler": [True, False],
3233
"with_ut": [True, False],
3334
"with_benchmark": [True, False],
@@ -44,6 +45,7 @@ class KnowhereConan(ConanFile):
4445
"with_diskann": False,
4546
"with_svs": False,
4647
"with_cardinal": False,
48+
"cardinal_version_force_checkout": False,
4749
"with_profiler": False,
4850
"with_ut": False,
4951
"glog/*:shared": True,
@@ -59,6 +61,7 @@ class KnowhereConan(ConanFile):
5961
"openssl/*:no_apps": True,
6062
"gflags/*:shared": True,
6163
"fmt/*:header_only": False,
64+
"openblas/*:dynamic_arch": True,
6265
"with_faiss_tests": False,
6366
"opentelemetry-cpp/*:with_stl": True,
6467
"libcurl/*:with_ssl": False,
@@ -107,7 +110,7 @@ def config_options(self):
107110
def configure(self):
108111
if self.options.shared:
109112
self.options.rm_safe("fPIC")
110-
if self.settings.os in ["Linux", "Android"] and str(self.settings.arch) in self._openblas_dynamic_arches:
113+
if self.settings.os == "Linux" and str(self.settings.arch) in self._openblas_dynamic_arches:
111114
self.options["openblas"].dynamic_arch = True
112115

113116
def requirements(self):
@@ -136,11 +139,9 @@ def requirements(self):
136139
self.requires("xxhash/0.8.3#caa6d0af1b951c247922e38fbcebdbe6")
137140
if self.settings.os == "Linux":
138141
self.requires("openblas/0.3.30")
139-
if self.settings.os == "Android":
140-
self.requires("openblas/0.3.30")
141142
if not self.options.with_light:
142143
self.requires("opentelemetry-cpp/1.23.0@milvus/dev#11bc565ec6e82910ae8f7471da756720")
143-
if self.settings.os not in ["Macos", "Android"]:
144+
if self.settings.os != "Macos":
144145
self.requires("libunwind/1.8.1#748a981ace010b80163a08867b732e71")
145146
if self.options.with_ut:
146147
self.requires("catch2/3.7.1")
@@ -210,6 +211,7 @@ def generate(self):
210211
tc.variables["WITH_DISKANN"] = self.options.with_diskann
211212
tc.variables["WITH_SVS"] = self.options.with_svs
212213
tc.variables["WITH_CARDINAL"] = self.options.with_cardinal
214+
tc.variables["CARDINAL_VERSION_FORCE_CHECKOUT"] = self.options.cardinal_version_force_checkout
213215
tc.variables["WITH_CUVS"] = self.options.with_cuvs
214216
tc.variables["WITH_PROFILER"] = self.options.with_profiler
215217
tc.variables["WITH_UT"] = self.options.with_ut

0 commit comments

Comments
 (0)