From ab1652029e77a226f70b143322be7ac9e63063f5 Mon Sep 17 00:00:00 2001 From: Yinzuo Jiang Date: Sat, 18 May 2024 20:21:01 +0800 Subject: [PATCH] fix: remove `-10` suffix for clang-tidy and clang-format in install_deps.sh Default llvm toolchain version in Ubuntu 20.04 is 10, while Ubuntu 22.04 does not have `clang-tidy-10` or `clang-format-10` by default. Upgrade clang-format and clang-tidy from 10 to 12, so that both Ubuntu 20.04 and 22.04 are able to run. See #33173 issue: #33142 Signed-off-by: Yinzuo Jiang Signed-off-by: Patrick Weizhi Xu Co-authored-by: Patrick Weizhi Xu --- build/docker/builder/cpu/ubuntu20.04/Dockerfile | 2 +- build/docker/builder/gpu/ubuntu20.04/Dockerfile | 2 +- build/docker/builder/gpu/ubuntu22.04/Dockerfile | 2 +- docs/design_docs/segcore/scripts_and_tools.md | 4 ++-- internal/core/cmake/FindClangTools.cmake | 2 +- internal/core/run_clang_format.sh | 2 +- scripts/install_deps.sh | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build/docker/builder/cpu/ubuntu20.04/Dockerfile b/build/docker/builder/cpu/ubuntu20.04/Dockerfile index beae59281a370..8e7f98ee89cf1 100644 --- a/build/docker/builder/cpu/ubuntu20.04/Dockerfile +++ b/build/docker/builder/cpu/ubuntu20.04/Dockerfile @@ -15,7 +15,7 @@ ARG TARGETARCH RUN apt-get update && apt-get install -y --no-install-recommends wget curl ca-certificates gnupg2 \ g++ gcc gdb gdbserver ninja-build git make ccache libssl-dev zlib1g-dev zip unzip \ - clang-format-10 clang-tidy-10 lcov libtool m4 autoconf automake python3 python3-pip \ + clang-format-12 clang-tidy-12 lcov libtool m4 autoconf automake python3 python3-pip \ pkg-config uuid-dev libaio-dev libopenblas-dev && \ apt-get remove --purge -y && \ rm -rf /var/lib/apt/lists/* diff --git a/build/docker/builder/gpu/ubuntu20.04/Dockerfile b/build/docker/builder/gpu/ubuntu20.04/Dockerfile index 5550e3fc82391..9378b3fd861b1 100644 --- a/build/docker/builder/gpu/ubuntu20.04/Dockerfile +++ b/build/docker/builder/gpu/ubuntu20.04/Dockerfile @@ -17,7 +17,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends wget curl ca-ce wget -qO- "https://cmake.org/files/v3.27/cmake-3.27.5-linux-`uname -m`.tar.gz" | tar --strip-components=1 -xz -C /usr/local && \ apt-get update && apt-get install -y --no-install-recommends \ g++ gcc gfortran git make ccache libssl-dev zlib1g-dev zip unzip \ - clang-format-10 clang-tidy-10 lcov libtool m4 autoconf automake python3 python3-pip \ + clang-format-12 clang-tidy-12 lcov libtool m4 autoconf automake python3 python3-pip \ pkg-config uuid-dev libaio-dev libgoogle-perftools-dev libopenblas-dev && \ apt-get remove --purge -y && \ rm -rf /var/lib/apt/lists/* diff --git a/build/docker/builder/gpu/ubuntu22.04/Dockerfile b/build/docker/builder/gpu/ubuntu22.04/Dockerfile index 3f487b008561c..b27a917d584e3 100644 --- a/build/docker/builder/gpu/ubuntu22.04/Dockerfile +++ b/build/docker/builder/gpu/ubuntu22.04/Dockerfile @@ -6,7 +6,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends wget curl ca-ce wget -qO- "https://cmake.org/files/v3.27/cmake-3.27.5-linux-`uname -m`.tar.gz" | tar --strip-components=1 -xz -C /usr/local && \ apt-get update && apt-get install -y --no-install-recommends \ g++ gcc gfortran git make ccache libssl-dev zlib1g-dev zip unzip \ - clang-format clang-tidy lcov libtool m4 autoconf automake python3 python3-pip \ + clang-format-12 clang-tidy-12 lcov libtool m4 autoconf automake python3 python3-pip \ pkg-config uuid-dev libaio-dev libgoogle-perftools-dev libopenblas-dev && \ apt-get remove --purge -y && \ rm -rf /var/lib/apt/lists/* diff --git a/docs/design_docs/segcore/scripts_and_tools.md b/docs/design_docs/segcore/scripts_and_tools.md index a364563935823..e59e7f3b7b384 100644 --- a/docs/design_docs/segcore/scripts_and_tools.md +++ b/docs/design_docs/segcore/scripts_and_tools.md @@ -5,8 +5,8 @@ The following scripts and commands may be used during segcore development. ## code format - under milvus/internal/core directory - - run `./run_clang_format .` to format cpp code - - to call clang-format-10, need to install `apt install clang-format-10` in advance + - run `./run_clang_format.sh .` to format cpp code + - to call clang-format-12, need to install `apt install clang-format-12` in advance - call `build-support/add_${lang}_license.sh` to add license info for cmake and cpp files - under milvus/ directory - use `make cppcheck` to check format, including diff --git a/internal/core/cmake/FindClangTools.cmake b/internal/core/cmake/FindClangTools.cmake index 6541010075ae6..2efbedb6e380c 100644 --- a/internal/core/cmake/FindClangTools.cmake +++ b/internal/core/cmake/FindClangTools.cmake @@ -78,7 +78,7 @@ if (CLANG_FORMAT_VERSION) else() find_program(CLANG_FORMAT_BIN NAMES - clang-format-10 + clang-format-12 clang-format PATHS ${ClangTools_PATH} $ENV{CLANG_TOOLS_PATH} /usr/local/bin /usr/bin NO_DEFAULT_PATH diff --git a/internal/core/run_clang_format.sh b/internal/core/run_clang_format.sh index 2aa22c514473a..a3e3131433d6e 100755 --- a/internal/core/run_clang_format.sh +++ b/internal/core/run_clang_format.sh @@ -7,7 +7,7 @@ fi CorePath=$1 formatThis() { - find "$1" | grep -E "(*\.cpp|*\.h|*\.cc)$" | grep -v "gen_tools/templates" | grep -v "\.pb\." | grep -v "tantivy-binding.h" | xargs clang-format-10 -i + find "$1" | grep -E "(*\.cpp|*\.h|*\.cc)$" | grep -v "gen_tools/templates" | grep -v "\.pb\." | grep -v "tantivy-binding.h" | xargs clang-format-12 -i } formatThis "${CorePath}/src" diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh index 8ae371aa2a075..1a455b980007a 100755 --- a/scripts/install_deps.sh +++ b/scripts/install_deps.sh @@ -21,7 +21,7 @@ function install_linux_deps() { # for Ubuntu 20.04 sudo apt install -y wget curl ca-certificates gnupg2 \ g++ gcc gfortran git make ccache libssl-dev zlib1g-dev zip unzip \ - clang-format-10 clang-tidy-10 lcov libtool m4 autoconf automake python3 python3-pip \ + clang-format-12 clang-tidy-12 lcov libtool m4 autoconf automake python3 python3-pip \ pkg-config uuid-dev libaio-dev libopenblas-dev libgoogle-perftools-dev sudo pip3 install conan==1.61.0