Skip to content

Commit ae50f1b

Browse files
committed
Fix build errors when WIRH_CARDINAL=true
Signed-off-by: yhmo <yihua.mo@zilliz.com>
1 parent c55ad73 commit ae50f1b

5 files changed

Lines changed: 28 additions & 8 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ set(CARDINAL_LIBS "")
180180
if(WITH_CARDINAL)
181181
add_definitions(-DKNOWHERE_WITH_CARDINAL)
182182
add_subdirectory(cmake/libs/cardinal/v1)
183+
target_link_libraries(cardinalv1 PRIVATE milvus-common::milvus-common)
183184
list(APPEND CARDINAL_LIBS cardinalv1)
184185
add_subdirectory(cmake/libs/cardinal/v2)
185186
list(APPEND CARDINAL_LIBS cardinalv2)

Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ BUILD_DIR ?= $(PWD)/build
1717
SHELL := /bin/bash
1818

1919
# Conan install-only flags (not valid for conan build)
20-
CONAN_INSTALL_FLAGS := --update --build=missing
20+
CONAN_INSTALL_FLAGS := --build=missing
2121

2222
# ---------- User-facing build flags ----------
2323
# Usage: make WITH_GPU=True WITH_UT=True WITH_ASAN=True WITH_DEBUG=True
@@ -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 12ad9e4687962624d8af7721b58367d11cf3fddb)
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: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ 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+
# now we use recipe branch of cardinal repo since the pr is not merged into cardinal repo: https://github.com/zilliztech/cardinal/pull/834
7+
# the cardinal repo fetches knowhere to run ci workflow so the two repos are coupling. to decouple them:
8+
# 1. use cardinal recipe branch in knowhere to pass the ci check
9+
# 2. in the cardianl pr#834, use the knowhere branch to run ci
10+
# 3. merge the knowhere pr
11+
# 4. in the cardinal pr#834, use the knowhere master branch to run ci, and merge the cardinal pr after ci passed
12+
set(CARDINAL_VERSION f0654cb40be0db57e73770707f44a1980b328423)
713
set(CARDINAL_REPO_URL "https://github.com/zilliztech/cardinal.git")
814

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

conanfile.py

Lines changed: 5 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,
@@ -107,7 +109,7 @@ def config_options(self):
107109
def configure(self):
108110
if self.options.shared:
109111
self.options.rm_safe("fPIC")
110-
if self.settings.os in ["Linux", "Android"] and str(self.settings.arch) in self._openblas_dynamic_arches:
112+
if self.settings.os == "Linux" and str(self.settings.arch) in self._openblas_dynamic_arches:
111113
self.options["openblas"].dynamic_arch = True
112114

113115
def requirements(self):
@@ -136,11 +138,9 @@ def requirements(self):
136138
self.requires("xxhash/0.8.3#caa6d0af1b951c247922e38fbcebdbe6")
137139
if self.settings.os == "Linux":
138140
self.requires("openblas/0.3.30")
139-
if self.settings.os == "Android":
140-
self.requires("openblas/0.3.30")
141141
if not self.options.with_light:
142142
self.requires("opentelemetry-cpp/1.23.0@milvus/dev#11bc565ec6e82910ae8f7471da756720")
143-
if self.settings.os not in ["Macos", "Android"]:
143+
if self.settings.os != "Macos":
144144
self.requires("libunwind/1.8.1#748a981ace010b80163a08867b732e71")
145145
if self.options.with_ut:
146146
self.requires("catch2/3.7.1")
@@ -210,6 +210,7 @@ def generate(self):
210210
tc.variables["WITH_DISKANN"] = self.options.with_diskann
211211
tc.variables["WITH_SVS"] = self.options.with_svs
212212
tc.variables["WITH_CARDINAL"] = self.options.with_cardinal
213+
tc.variables["CARDINAL_VERSION_FORCE_CHECKOUT"] = self.options.cardinal_version_force_checkout
213214
tc.variables["WITH_CUVS"] = self.options.with_cuvs
214215
tc.variables["WITH_PROFILER"] = self.options.with_profiler
215216
tc.variables["WITH_UT"] = self.options.with_ut

0 commit comments

Comments
 (0)