From ecec29049fceb97f3aa19bacd65f705d56eaf15c Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Thu, 13 Jul 2023 15:47:11 -0700 Subject: [PATCH] Add gcc version ceiling verification before building k-NN on arm64 (#987) (#988) * Add gcc version ceiling verification before building k-NN on arm64 Signed-off-by: Peter Zhu * Add more comments Signed-off-by: Peter Zhu --------- Signed-off-by: Peter Zhu (cherry picked from commit afdf12511bc9a171ca364965b7107d6cf669f691) Co-authored-by: Peter Zhu --- scripts/build.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/build.sh b/scripts/build.sh index 683ed47dc..a7f8e356a 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -106,6 +106,7 @@ if [ "$JAVA_HOME" = "" ]; then fi # Ensure gcc version is above 4.9.0 for faiss 1.7.4+ compilation +# https://github.com/opensearch-project/k-NN/issues/975 GCC_VERSION=`gcc --version | head -n 1 | cut -d ' ' -f3` GCC_REQUIRED_VERSION=4.9.0 COMPARE_VERSION=`echo $GCC_REQUIRED_VERSION $GCC_VERSION | tr ' ' '\n' | sort -V | uniq | head -n 1` @@ -114,6 +115,16 @@ if [ ! "$COMPARE_VERSION" = "$GCC_REQUIRED_VERSION" ]; then exit 1 fi +# Ensure gcc version is below 8.0.0 for faiss 1.7.4+ compilation so it will not crash on arm64 CentOS7 +# https://github.com/opensearch-project/k-NN/issues/975 +GCC_REQUIRED_VERSION_CEILING=8.0.0 +COMPARE_VERSION_CEILING=`echo $GCC_REQUIRED_VERSION_CEILING $GCC_VERSION | tr ' ' '\n' | sort -V | uniq | tail -n 1` +if [ ! "$COMPARE_VERSION_CEILING" = "$GCC_REQUIRED_VERSION_CEILING" ]; then + echo "gcc version on this env is newer than $GCC_REQUIRED_VERSION_CEILING, exit 1" + exit 1 +fi + + # Build k-NN lib and plugin through gradle tasks cd $work_dir # Gradle build is used here to replace gradle assemble due to build will also call cmake and make before generating jars