Skip to content

Commit e1d0334

Browse files
authored
[SVS] Add support for GLIBC 2.26 systems and GCC v11.2. E.g. AmazonLinux 2 (#720)
* [SVS] Add support for GLIBC 2.26 systems. E.g. AmazonLinux 2 * Workaround GCC v11.2 C++20 compatibility issue * fixup! [SVS] Add support for GLIBC 2.26 systems. E.g. AmazonLinux 2
1 parent 44acb87 commit e1d0334

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

cmake/svs.cmake

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,34 @@ if(USE_SVS)
4242

4343
# detect if build environment is using glibc
4444
include(CheckSymbolExists)
45-
unset(GLIBC_FOUND CACHE)
4645
check_symbol_exists(__GLIBC__ "features.h" GLIBC_FOUND)
47-
if(NOT GLIBC_FOUND)
48-
message(STATUS "GLIBC is not detected - SVS shared library is not supported")
46+
if(GLIBC_FOUND)
47+
include(CheckCXXSourceRuns)
48+
check_cxx_source_runs("#include <features.h>
49+
int main(){ return __GLIBC__ == 2 && __GLIBC_MINOR__ >= 28 ?0:1; }"
50+
GLIBC_2_28_FOUND)
51+
check_cxx_source_runs("#include <features.h>
52+
int main(){ return __GLIBC__ == 2 && __GLIBC_MINOR__ >= 26 ?0:1; }"
53+
GLIBC_2_26_FOUND)
4954
endif()
5055

5156
cmake_dependent_option(SVS_SHARED_LIB "Use SVS pre-compiled shared library" ON "USE_SVS AND GLIBC_FOUND AND SVS_LVQ_SUPPORTED" OFF)
5257
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
53-
set(SVS_URL "https://github.com/intel/ScalableVectorSearch/releases/download/v0.0.8-dev/svs-shared-library-0.0.8-NIGHTLY-20250629-clang.tar.gz" CACHE STRING "SVS URL")
58+
if (GLIBC_2_28_FOUND)
59+
set(SVS_URL "https://github.com/intel/ScalableVectorSearch/releases/download/v0.0.8-dev/svs-shared-library-0.0.8-NIGHTLY-20250629-clang.tar.gz" CACHE STRING "SVS URL")
60+
else()
61+
message(STATUS "GLIBC>=2.28 is required for Clang build - disabling SVS_SHARED_LIB")
62+
set(SVS_SHARED_LIB OFF)
63+
endif()
5464
else()
55-
set(SVS_URL "https://github.com/intel/ScalableVectorSearch/releases/download/v0.0.8-dev/svs-shared-library-0.0.8-NIGHTLY-20250630.tar.gz" CACHE STRING "SVS URL")
65+
if (GLIBC_2_28_FOUND)
66+
set(SVS_URL "https://github.com/intel/ScalableVectorSearch/releases/download/v0.0.8-dev/svs-shared-library-0.0.8-NIGHTLY-20250630.tar.gz" CACHE STRING "SVS URL")
67+
elseif(GLIBC_2_26_FOUND)
68+
set(SVS_URL "https://github.com/intel/ScalableVectorSearch/releases/download/v0.0.8-dev/svs-shared-library-0.0.8-NIGHTLY-20250701-glibc-2_26.tar.gz" CACHE STRING "SVS URL")
69+
else()
70+
message(STATUS "GLIBC>=2.26 is required for SVS shared library - disabling SVS_SHARED_LIB")
71+
set(SVS_SHARED_LIB OFF)
72+
endif()
5673
endif()
5774

5875
if(SVS_SHARED_LIB)

tests/unit/test_svs.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2790,7 +2790,7 @@ TYPED_TEST(SVSTest, logging_runtime_params) {
27902790
index_logger->critical("Custom log critical");
27912791
index_logger->flush();
27922792
// Check that the log messages are written to the ostringstream
2793-
auto index_log = os_index.view();
2793+
auto index_log = os_index.str();
27942794
EXPECT_NE(index_log.find("Custom log trace"), std::string::npos);
27952795
EXPECT_NE(index_log.find("Custom log debug"), std::string::npos);
27962796
EXPECT_NE(index_log.find("Custom log info"), std::string::npos);
@@ -2800,7 +2800,7 @@ TYPED_TEST(SVSTest, logging_runtime_params) {
28002800

28012801
VecSimIndex_Free(index);
28022802

2803-
auto global_log = os_global.view();
2803+
auto global_log = os_global.str();
28042804
EXPECT_TRUE(global_log.empty()) << "Global log should be empty, but got: " << global_log;
28052805
}
28062806

0 commit comments

Comments
 (0)