diff --git a/.github/licenserc.yml b/.github/licenserc.yml index f9323be8d29..eeafe3a2aa7 100644 --- a/.github/licenserc.yml +++ b/.github/licenserc.yml @@ -18,7 +18,7 @@ header: - '.github/' - 'docs/' - 'tests/testsdata/' - - 'release-centos7-llvm/dockerfiles/' + - 'release-linux-llvm/dockerfiles/' - '**/.gitignore' - '**/*.md' - '**/*.json' diff --git a/.gitignore b/.gitignore index 47af0ed5258..0383822a194 100644 --- a/.gitignore +++ b/.gitignore @@ -43,7 +43,6 @@ callgrind.out.* # ignore build files CMakeCache.txt CMakeFiles -Makefile cmake_install.cmake CTestTestfile.cmake *.a @@ -78,8 +77,8 @@ debian/*.substvars *.pb.h # TiFlash built and test files -release-centos7/tiflash -release-centos7/build-release +release-rocky8/tiflash +release-rocky8/build-release release-darwin/tiflash release-darwin/build-release @@ -91,5 +90,5 @@ tests/docker/log CoverageReport # installation and sysroot path -release-centos7-llvm/tiflash -release-centos7-llvm/build-release +release-linux-llvm/tiflash +release-linux-llvm/build-release diff --git a/README.md b/README.md index 158330114d9..28398b37a85 100644 --- a/README.md +++ b/README.md @@ -104,9 +104,9 @@ sudo pacman -S clang lld libc++ libc++abi compiler-rt openmp lcov cmake ninja cu
-CentOS 7 +Rocky Linux 8 -Please refer to [release-centos7-llvm/env/prepare-sysroot.sh](./release-centos7-llvm/env/prepare-sysroot.sh) +Please refer to [release-linux-llvm/env/prepare-sysroot.sh](./release-linux-llvm/env/prepare-sysroot.sh)
@@ -329,10 +329,10 @@ More usages are available via `./dbms/bench_dbms --help`. ## Generate LLVM Coverage Report -To build coverage report, run the script under `release-centos7-llvm` +To build coverage report, run the script under `release-linux-llvm` ```shell -cd release-centos7-llvm +cd release-linux-llvm ./gen_coverage.sh # Or run with filter: # FILTER='*DMFile*:*DeltaMerge*:*Segment*' ./gen_coverage.sh @@ -354,7 +354,7 @@ Before submitting a pull request, please resolve clang-tidy errors and use [form ```shell # In the TiFlash repository root: merge_base=$(git merge-base upstream/master HEAD) -python3 release-centos7-llvm/scripts/run-clang-tidy.py -p cmake-build-debug -j 20 --files `git diff $merge_base --name-only` +python3 release-linux-llvm/scripts/run-clang-tidy.py -p cmake-build-debug -j 20 --files `git diff $merge_base --name-only` # if there are too much errors, you can try to run the script again with `-fix` python3 format-diff.py --diff_from $merge_base ``` diff --git a/release-centos7-llvm/Makefile b/release-centos7-llvm/Makefile deleted file mode 100644 index 17b4a57e144..00000000000 --- a/release-centos7-llvm/Makefile +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright 2022 PingCAP, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -DOCKER ?= docker -SUFFIX ?= "" - -# Base docker files with prerequisites build tools -image_tiflash_llvm_base_amd64: - $(DOCKER) build dockerfiles -f dockerfiles/tiflash-llvm-base-amd64 -t hub.pingcap.net/tiflash/tiflash-llvm-base:amd64$(SUFFIX) - -image_tiflash_llvm_base_aarch64: - $(DOCKER) build dockerfiles -f dockerfiles/tiflash-llvm-base-aarch64 -t hub.pingcap.net/tiflash/tiflash-llvm-base:aarch64$(SUFFIX) - -# Build tiflash binaries under directory "tiflash" -build_tiflash_release_amd64: - $(DOCKER) run --rm -v $(realpath ..):/build/tics hub.pingcap.net/tiflash/tiflash-llvm-base:amd64$(SUFFIX) /build/tics/release-centos7-llvm/scripts/build-release.sh - -build_tiflash_release_aarch64: - $(DOCKER) run --rm -v $(realpath ..):/build/tics hub.pingcap.net/tiflash/tiflash-llvm-base:aarch64$(SUFFIX) /build/tics/release-centos7-llvm/scripts/build-release.sh - -# Package tiflash docker image using the binaries under directory "tiflash" -image_tiflash_release: - $(DOCKER) build -f dockerfiles/Dockerfile-tiflash-centos7 -t hub.pingcap.net/tiflash/tiflash-server-centos7 . - -# Add build_tiflash_debug_amd64 target to enable FailPoints on x86. Since outputs are the same as release version, no new package targets added. -build_tiflash_debug_amd64: - $(DOCKER) run --rm -v $(realpath ..):/build/tics hub.pingcap.net/tiflash/tiflash-llvm-base:amd64 /build/tics/release-centos7-llvm/scripts/build-debug.sh - -build_tiflash_tsan_amd64: - $(DOCKER) run --rm -v $(realpath ..):/build/tics hub.pingcap.net/tiflash/tiflash-llvm-base:amd64 /build/tics/release-centos7-llvm/scripts/build-tsan.sh - -build_tiflash_asan_amd64: - $(DOCKER) run --rm -v $(realpath ..):/build/tics hub.pingcap.net/tiflash/tiflash-llvm-base:amd64 /build/tics/release-centos7-llvm/scripts/build-asan.sh - -build_tiflash_ci_amd64: - $(DOCKER) run --rm -v $(realpath ..):/build/tics hub.pingcap.net/tiflash/tiflash-llvm-base:amd64 /build/tics/release-centos7-llvm/scripts/build-tiflash-ci.sh - -build_tiflash_ci_aarch64: - $(DOCKER) run --rm -v $(realpath ..):/build/tics hub.pingcap.net/tiflash/tiflash-llvm-base:aarch64 /build/tics/release-centos7-llvm/scripts/build-tiflash-ci.sh - -# Base docker with prerequisites running CI -image_tiflash_ci_base: - $(DOCKER) build -f dockerfiles/Dockerfile-tiflash-ci-base -t hub.pingcap.net/tiflash/tiflash-ci-base . - -# Package tiflash CI docker image using the binaries under directory "tiflash" -image_tiflash_ci: - $(DOCKER) build -f dockerfiles/Dockerfile-tiflash-ci -t hub.pingcap.net/tiflash/tiflash-ci-centos7 . diff --git a/release-centos7-llvm/dockerfiles/misc/bake_llvm_base_amd64.sh b/release-centos7-llvm/dockerfiles/misc/bake_llvm_base_amd64.sh deleted file mode 100644 index 1afda38ce7f..00000000000 --- a/release-centos7-llvm/dockerfiles/misc/bake_llvm_base_amd64.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2023 PingCAP, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -# Build CI/CD image - -function bake_llvm_base_amd64() { - export PATH="/opt/cmake/bin:/usr/local/bin/:${PATH}" - export LIBRARY_PATH="/usr/local/lib/x86_64-unknown-linux-gnu/:${LIBRARY_PATH:+LIBRARY_PATH:}" - export LD_LIBRARY_PATH="/usr/local/lib/x86_64-unknown-linux-gnu/:${LD_LIBRARY_PATH:+LD_LIBRARY_PATH:}" - export CPLUS_INCLUDE_PATH="/usr/local/include/x86_64-unknown-linux-gnu/c++/v1/:${CPLUS_INCLUDE_PATH:+CPLUS_INCLUDE_PATH:}" - SCRIPTPATH=$(cd $(dirname "$0"); pwd -P) - - # Basic Environment - source $SCRIPTPATH/prepare_basic.sh - prepare_basic - - # CMake - source $SCRIPTPATH/install_cmake.sh - install_cmake "3.24.2" "x86_64" - - # LLVM - source $SCRIPTPATH/bootstrap_llvm.sh - bootstrap_llvm "17.0.6" - export CC=clang - export CXX=clang++ - export LD=ld.lld - - # OpenSSL - source $SCRIPTPATH/install_openssl.sh - install_openssl "1_1_1w" - export OPENSSL_ROOT_DIR="/usr/local/opt/openssl" - - # Git - source $SCRIPTPATH/install_git.sh - install_git "2.40.1" - - # Go - source $SCRIPTPATH/install_go.sh - install_go "1.20" "amd64" - export PATH="$PATH:/usr/local/go/bin" - - # Rust - source $SCRIPTPATH/install_rust.sh - install_rust - source $HOME/.cargo/env - - # ccache - source $SCRIPTPATH/install_ccache.sh - install_ccache "4.5.1" -} - -bake_llvm_base_amd64 diff --git a/release-centos7-llvm/dockerfiles/misc/install_git.sh b/release-centos7-llvm/dockerfiles/misc/install_git.sh deleted file mode 100644 index d1b77d3243e..00000000000 --- a/release-centos7-llvm/dockerfiles/misc/install_git.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2022 PingCAP, Ltd. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Install git for CI/CD. -# Require: openssl - -function install_git() { - # $1: git version - wget -O git.tar.gz https://github.com/git/git/archive/refs/tags/v$1.tar.gz - mkdir git && cd git - tar -xzvf ../git.tar.gz --strip-components=1 - make configure - ./configure --with-openssl $OPENSSL_ROOT_DIR --prefix /usr/local - make -j - make install - cd .. - rm -rf git git.tar.gz -} diff --git a/release-centos7-llvm/dockerfiles/misc/install_go.sh b/release-centos7-llvm/dockerfiles/misc/install_go.sh deleted file mode 100644 index 30712704658..00000000000 --- a/release-centos7-llvm/dockerfiles/misc/install_go.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2023 PingCAP, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -# Install Go for CI/CD. -# Require: wget, tar - -function install_go() { - # $1: go_version - # $2: go_arch - wget https://dl.google.com/go/go$1.linux-$2.tar.gz - tar -C /usr/local -xzvf go$1.linux-$2.tar.gz - rm -rf go$1.linux-$2.tar.gz -} diff --git a/release-centos7-llvm/dockerfiles/tiflash-llvm-base-amd64 b/release-centos7-llvm/dockerfiles/tiflash-llvm-base-amd64 deleted file mode 100644 index a42142af92f..00000000000 --- a/release-centos7-llvm/dockerfiles/tiflash-llvm-base-amd64 +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2022 PingCAP, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM hub.pingcap.net/tiflash/centos:7.9.2009-amd64 - -COPY misc /misc - -RUN sh /misc/bake_llvm_base_amd64.sh - -ENV PATH="/opt/cmake/bin:/usr/local/bin/:${PATH}:/usr/local/go/bin:/root/.cargo/bin" \ - LIBRARY_PATH="/usr/local/lib/x86_64-unknown-linux-gnu/:${LIBRARY_PATH}" \ - LD_LIBRARY_PATH="/usr/local/lib/x86_64-unknown-linux-gnu/:${LD_LIBRARY_PATH}" \ - CPLUS_INCLUDE_PATH="/usr/local/include/x86_64-unknown-linux-gnu/c++/v1/:${CPLUS_INCLUDE_PATH}" \ - OPENSSL_ROOT_DIR="/usr/local/opt/openssl" \ - CC=clang \ - CXX=clang++ \ - LD=ld.lld - -USER root -WORKDIR /root/ -ENV HOME /root/ -ENV TZ Asia/Shanghai -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone diff --git a/release-linux-llvm/Makefile b/release-linux-llvm/Makefile new file mode 100644 index 00000000000..8b9c5acac2a --- /dev/null +++ b/release-linux-llvm/Makefile @@ -0,0 +1,46 @@ +# Copyright 2022 PingCAP, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DOCKER ?= docker +SUFFIX ?= "" + +# Base docker files with prerequisites build tools +image_tiflash_llvm_base: + $(DOCKER) build dockerfiles -f dockerfiles/Dockerfile-tiflash-llvm-base -t hub.pingcap.net/tiflash/tiflash-llvm-base:rocky8$(SUFFIX) + +# Build tiflash binaries under directory "tiflash" +build_tiflash_release: + $(DOCKER) run --rm -v $(realpath ..):/build/tics hub.pingcap.net/tiflash/tiflash-llvm-base:rocky8$(SUFFIX) /build/tics/release-linux-llvm/scripts/build-release.sh + +# Package tiflash docker image using the binaries under directory "tiflash" +image_tiflash_release: + $(DOCKER) build -f dockerfiles/Dockerfile-tiflash-rocky8 -t hub.pingcap.net/tiflash/tiflash-server-rocky8 . + +# Add build_tiflash_debug target to enable FailPoints. Since outputs are the same as release version, no new package targets added. +build_tiflash_debug: + $(DOCKER) run --rm -v $(realpath ..):/build/tics hub.pingcap.net/tiflash/tiflash-llvm-base:rocky8$(SUFFIX) /build/tics/release-linux-llvm/scripts/build-debug.sh + +build_tiflash_tsan: + $(DOCKER) run --rm -v $(realpath ..):/build/tics hub.pingcap.net/tiflash/tiflash-llvm-base:rocky8$(SUFFIX) /build/tics/release-linux-llvm/scripts/build-tsan.sh + +build_tiflash_asan: + $(DOCKER) run --rm -v $(realpath ..):/build/tics hub.pingcap.net/tiflash/tiflash-llvm-base:rocky8$(SUFFIX) /build/tics/release-linux-llvm/scripts/build-asan.sh + +# Base docker with prerequisites running CI +image_tiflash_ci_base: + $(DOCKER) build -f dockerfiles/Dockerfile-tiflash-ci-base -t hub.pingcap.net/tiflash/tiflash-ci-base . + +# Package tiflash CI docker image using the binaries under directory "tiflash" +image_tiflash_ci: + $(DOCKER) build -f dockerfiles/Dockerfile-tiflash-ci -t hub.pingcap.net/tiflash/tiflash-ci-rocky8 . diff --git a/release-centos7-llvm/README.md b/release-linux-llvm/README.md similarity index 54% rename from release-centos7-llvm/README.md rename to release-linux-llvm/README.md index b02a71faafb..9ad23f994ee 100644 --- a/release-centos7-llvm/README.md +++ b/release-linux-llvm/README.md @@ -1,13 +1,11 @@ -# Docker Builder for centos 7 +# Docker Builder for Rocky Linux 8 -Scripts to build TiFlash binaries under centos 7 +Scripts to build TiFlash binaries under Rocky Linux 8 Usage: ```bash -> make build_tiflash_release_amd64 -# Or aarch64 -#> make build_tiflash_release_aarch64 +> make build_tiflash_release # The binaries is built under directory `tiflash`, check its information > ./tiflash/tiflash version ``` @@ -16,17 +14,13 @@ Usage: Update the script -- `dockerfiles/misc/bake_llvm_base_amd64.sh` -- `dockerfiles/misc/bake_llvm_base_aarch64.sh` +- `dockerfiles/misc/bake_llvm_base.sh` ```bash # Build the base docker with suffix. -> SUFFIX=-llvm-17.0.6 make image_tiflash_llvm_base_amd64 +> SUFFIX=-llvm-17.0.6 make image_tiflash_llvm_base # Use the new base docker to build TiFlash binary -> SUFFIX=-llvm-17.0.6 make build_tiflash_release_amd64 -# Or aarch64 -#> SUFFIX=-llvm-17.0.6 make image_tiflash_llvm_base_aarch64 -#> SUFFIX=-llvm-17.0.6 make build_tiflash_release_aarch64 +> SUFFIX=-llvm-17.0.6 make build_tiflash_release # The binaries is built under directory `tiflash`, check its information > ./tiflash/tiflash version TiFlash @@ -40,7 +34,7 @@ Raft Proxy # Push the new base docker to the dockerhub, usually it is "hub.pingcap.net" > docker login -u -p -> docker image push /tiflash/tiflash-llvm-base:amd64-llvm-17.0.6 +> docker image push /tiflash/tiflash-llvm-base:rocky8-llvm-17.0.6 ``` At last, change the suffix in `${REPO_DIR}/.toolchain.yml` and check the built target in the CI. @@ -50,10 +44,7 @@ How to get into a build container: ``` SUFFIX=-llvm-17.0.6 -# x86_64 -docker run -it --rm -v /your/path/to/tiflash:/build/tics hub.pingcap.net/tiflash/tiflash-llvm-base:amd64${SUFFIX} /bin/bash -# arm -docker run -it --rm -v /your/path/to/tiflash:/build/tics hub.pingcap.net/tiflash/tiflash-llvm-base:aarch64${SUFFIX} /bin/bash +docker run -it --rm -v /your/path/to/tiflash:/build/tics hub.pingcap.net/tiflash/tiflash-llvm-base:rocky8${SUFFIX} /bin/bash ``` ## Local toolchain prerequisites diff --git a/release-centos7-llvm/dockerfiles/Dockerfile-tiflash-ci b/release-linux-llvm/dockerfiles/Dockerfile-tiflash-ci similarity index 100% rename from release-centos7-llvm/dockerfiles/Dockerfile-tiflash-ci rename to release-linux-llvm/dockerfiles/Dockerfile-tiflash-ci diff --git a/release-centos7-llvm/dockerfiles/Dockerfile-tiflash-ci-base b/release-linux-llvm/dockerfiles/Dockerfile-tiflash-ci-base similarity index 100% rename from release-centos7-llvm/dockerfiles/Dockerfile-tiflash-ci-base rename to release-linux-llvm/dockerfiles/Dockerfile-tiflash-ci-base diff --git a/release-centos7-llvm/dockerfiles/tiflash-llvm-base-aarch64 b/release-linux-llvm/dockerfiles/Dockerfile-tiflash-llvm-base similarity index 70% rename from release-centos7-llvm/dockerfiles/tiflash-llvm-base-aarch64 rename to release-linux-llvm/dockerfiles/Dockerfile-tiflash-llvm-base index d5b169da8de..cab4c0a4c45 100644 --- a/release-centos7-llvm/dockerfiles/tiflash-llvm-base-aarch64 +++ b/release-linux-llvm/dockerfiles/Dockerfile-tiflash-llvm-base @@ -12,16 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM hub.pingcap.net/tiflash/centos:7.9.2009-aarch64 +# Multiple platform support + +FROM quay.io/rockylinux/rockylinux:8.10.20240528-ubi COPY misc /misc -RUN sh /misc/bake_llvm_base_aarch64.sh +RUN sh /misc/bake_llvm_base.sh ENV PATH="/opt/cmake/bin:/usr/local/bin/:${PATH}:/usr/local/go/bin:/root/.cargo/bin" \ - LIBRARY_PATH="/usr/local/lib/aarch64-unknown-linux-gnu/:${LIBRARY_PATH}" \ - LD_LIBRARY_PATH="/usr/local/lib/aarch64-unknown-linux-gnu/:${LD_LIBRARY_PATH}" \ - CPLUS_INCLUDE_PATH="/usr/local/include/aarch64-unknown-linux-gnu/c++/v1/:${CPLUS_INCLUDE_PATH}" \ + LIBRARY_PATH="/usr/local/lib/$(uname -m)-unknown-linux-gnu/:${LIBRARY_PATH}" \ + LD_LIBRARY_PATH="/usr/local/lib/$(uname -m)-unknown-linux-gnu/:${LD_LIBRARY_PATH}" \ + CPLUS_INCLUDE_PATH="/usr/local/include/$(uname -m)-unknown-linux-gnu/c++/v1/:${CPLUS_INCLUDE_PATH}" \ OPENSSL_ROOT_DIR="/usr/local/opt/openssl" \ CC=clang \ CXX=clang++ \ diff --git a/release-centos7-llvm/dockerfiles/Dockerfile-tiflash-centos7 b/release-linux-llvm/dockerfiles/Dockerfile-tiflash-rocky8 similarity index 93% rename from release-centos7-llvm/dockerfiles/Dockerfile-tiflash-centos7 rename to release-linux-llvm/dockerfiles/Dockerfile-tiflash-rocky8 index b4bf6ce315c..2b173402115 100644 --- a/release-centos7-llvm/dockerfiles/Dockerfile-tiflash-centos7 +++ b/release-linux-llvm/dockerfiles/Dockerfile-tiflash-rocky8 @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM hub.pingcap.net/tiflash/centos:7.9.2009-amd64 +FROM quay.io/rockylinux/rockylinux:8.10.20240528-ubi USER root WORKDIR /root/ diff --git a/release-centos7-llvm/dockerfiles/misc/bake_llvm_base_aarch64.sh b/release-linux-llvm/dockerfiles/misc/bake_llvm_base.sh similarity index 72% rename from release-centos7-llvm/dockerfiles/misc/bake_llvm_base_aarch64.sh rename to release-linux-llvm/dockerfiles/misc/bake_llvm_base.sh index 106b1f8384e..aaa6e907a24 100644 --- a/release-centos7-llvm/dockerfiles/misc/bake_llvm_base_aarch64.sh +++ b/release-linux-llvm/dockerfiles/misc/bake_llvm_base.sh @@ -16,21 +16,23 @@ # Build CI/CD image -function bake_llvm_base_aarch64() { +set -eox pipefail + +function bake_llvm_base() { + arch=$(uname -m) export PATH="/opt/cmake/bin:/usr/local/bin/:${PATH}" - export LIBRARY_PATH="/usr/local/lib/aarch64-unknown-linux-gnu/:${LIBRARY_PATH:+LIBRARY_PATH:}" - export LD_LIBRARY_PATH="/usr/local/lib/aarch64-unknown-linux-gnu/:${LD_LIBRARY_PATH:+LD_LIBRARY_PATH:}" - export CPLUS_INCLUDE_PATH="/usr/local/include/aarch64-unknown-linux-gnu/c++/v1/:${CPLUS_INCLUDE_PATH:+CPLUS_INCLUDE_PATH:}" + export LIBRARY_PATH="/usr/local/lib/${arch}-unknown-linux-gnu/:${LIBRARY_PATH:+LIBRARY_PATH:}" + export LD_LIBRARY_PATH="/usr/local/lib/${arch}-unknown-linux-gnu/:${LD_LIBRARY_PATH:+LD_LIBRARY_PATH:}" + export CPLUS_INCLUDE_PATH="/usr/local/include/${arch}-unknown-linux-gnu/c++/v1/:${CPLUS_INCLUDE_PATH:+CPLUS_INCLUDE_PATH:}" SCRIPTPATH=$(cd $(dirname "$0"); pwd -P) # Basic Environment source $SCRIPTPATH/prepare_basic.sh prepare_basic - ln -sf /usr/bin/ninja-build /usr/bin/ninja # CMake source $SCRIPTPATH/install_cmake.sh - install_cmake "3.24.2" "aarch64" + install_cmake "3.24.2" # LLVM source $SCRIPTPATH/bootstrap_llvm.sh @@ -44,15 +46,6 @@ function bake_llvm_base_aarch64() { install_openssl "1_1_1w" export OPENSSL_ROOT_DIR="/usr/local/opt/openssl" - # Git - source $SCRIPTPATH/install_git.sh - install_git "2.40.1" - - # Go - source $SCRIPTPATH/install_go.sh - install_go "1.20" "arm64" - export PATH="$PATH:/usr/local/go/bin" - # Rust source $SCRIPTPATH/install_rust.sh install_rust @@ -60,7 +53,7 @@ function bake_llvm_base_aarch64() { # ccache source $SCRIPTPATH/install_ccache.sh - install_ccache "4.5.1" + install_ccache "4.10.2" } -bake_llvm_base_aarch64 +bake_llvm_base diff --git a/release-centos7-llvm/dockerfiles/misc/bootstrap_llvm.sh b/release-linux-llvm/dockerfiles/misc/bootstrap_llvm.sh similarity index 92% rename from release-centos7-llvm/dockerfiles/misc/bootstrap_llvm.sh rename to release-linux-llvm/dockerfiles/misc/bootstrap_llvm.sh index d6d38afdbaa..8e4d0a554b2 100644 --- a/release-centos7-llvm/dockerfiles/misc/bootstrap_llvm.sh +++ b/release-linux-llvm/dockerfiles/misc/bootstrap_llvm.sh @@ -16,12 +16,12 @@ INSTALL_PREFIX=${INSTALL_PREFIX:-"/usr/local"} # Boostrap LLVM envriroment for CI/CD. -# Require: git, ninja, cmake, compiler(devtoolset-10) -# LLVM License: https://releases.llvm.org/13.0.0/LICENSE.TXT +# Require: git, ninja, cmake, compiler(gcc-toolset-100) +# LLVM License: https://releases.llvm.org/17.0.6/LICENSE.TXT function bootstrap_llvm() { # $1: llvm_version - source scl_source enable devtoolset-10 + source /opt/rh/gcc-toolset-10/enable git clone https://github.com/llvm/llvm-project --depth=1 -b llvmorg-$1 mkdir -p llvm-project/build diff --git a/release-centos7-llvm/dockerfiles/misc/cargo-config b/release-linux-llvm/dockerfiles/misc/cargo-config similarity index 100% rename from release-centos7-llvm/dockerfiles/misc/cargo-config rename to release-linux-llvm/dockerfiles/misc/cargo-config diff --git a/release-centos7-llvm/dockerfiles/misc/install_ccache.sh b/release-linux-llvm/dockerfiles/misc/install_ccache.sh similarity index 100% rename from release-centos7-llvm/dockerfiles/misc/install_ccache.sh rename to release-linux-llvm/dockerfiles/misc/install_ccache.sh diff --git a/release-centos7-llvm/dockerfiles/misc/install_cmake.sh b/release-linux-llvm/dockerfiles/misc/install_cmake.sh similarity index 83% rename from release-centos7-llvm/dockerfiles/misc/install_cmake.sh rename to release-linux-llvm/dockerfiles/misc/install_cmake.sh index eda327425ea..d8346e69345 100644 --- a/release-centos7-llvm/dockerfiles/misc/install_cmake.sh +++ b/release-linux-llvm/dockerfiles/misc/install_cmake.sh @@ -20,9 +20,9 @@ function install_cmake() { # $1: cmake_version - # $2: cmake_arch - wget https://github.com/Kitware/CMake/releases/download/v$1/cmake-$1-linux-$2.sh + arch=$(uname -m) + wget https://github.com/Kitware/CMake/releases/download/v$1/cmake-$1-linux-${arch}.sh mkdir -p /opt/cmake - sh cmake-$1-linux-$2.sh --prefix=/opt/cmake --skip-license --exclude-subdir - rm -rf cmake-$1-linux-$2.sh + sh cmake-$1-linux-${arch}.sh --prefix=/opt/cmake --skip-license --exclude-subdir + rm -rf cmake-$1-linux-${arch}.sh } diff --git a/release-centos7-llvm/dockerfiles/misc/install_openssl.sh b/release-linux-llvm/dockerfiles/misc/install_openssl.sh similarity index 100% rename from release-centos7-llvm/dockerfiles/misc/install_openssl.sh rename to release-linux-llvm/dockerfiles/misc/install_openssl.sh diff --git a/release-centos7-llvm/dockerfiles/misc/install_rust.sh b/release-linux-llvm/dockerfiles/misc/install_rust.sh similarity index 100% rename from release-centos7-llvm/dockerfiles/misc/install_rust.sh rename to release-linux-llvm/dockerfiles/misc/install_rust.sh diff --git a/release-centos7-llvm/dockerfiles/misc/prepare_basic.sh b/release-linux-llvm/dockerfiles/misc/prepare_basic.sh similarity index 58% rename from release-centos7-llvm/dockerfiles/misc/prepare_basic.sh rename to release-linux-llvm/dockerfiles/misc/prepare_basic.sh index f5ab4b3f8be..342ffe1ff98 100644 --- a/release-centos7-llvm/dockerfiles/misc/prepare_basic.sh +++ b/release-linux-llvm/dockerfiles/misc/prepare_basic.sh @@ -17,21 +17,17 @@ # Prepare basic environment for CI/CD. function prepare_basic() { - yum install -y epel-release centos-release-scl && \ - sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo && \ - sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo && \ - sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo - yum install -y \ - devscripts \ - fakeroot \ - debhelper \ + dnf upgrade-minimal -y + dnf install -y epel-release + dnf config-manager --set-enabled powertools + dnf install -y \ libtool \ - ncurses-static \ libtool-ltdl-devel \ python3-devel \ + libcurl-devel \ bzip2 \ chrpath - yum install -y curl git perl wget cmake3 glibc-static zlib-devel diffutils ninja-build devtoolset-10 - yum install -y 'perl(Data::Dumper)' - yum clean all -y + dnf install -y curl git perl wget cmake3 gettext glibc-static zlib-devel diffutils ninja-build gcc-toolset-10 + dnf install -y 'perl(Data::Dumper)' + dnf clean all -y } diff --git a/release-centos7-llvm/env/.gitignore b/release-linux-llvm/env/.gitignore similarity index 100% rename from release-centos7-llvm/env/.gitignore rename to release-linux-llvm/env/.gitignore diff --git a/release-centos7-llvm/env/Makefile b/release-linux-llvm/env/Makefile similarity index 89% rename from release-centos7-llvm/env/Makefile rename to release-linux-llvm/env/Makefile index 09edf8d7f6c..18783274ffb 100644 --- a/release-centos7-llvm/env/Makefile +++ b/release-linux-llvm/env/Makefile @@ -15,7 +15,7 @@ DOCKER ?= docker ARCH=$(shell uname -m) MOUNT=$(shell realpath tiflash-env) -DOCKER_TAG=$(shell [[ "$(ARCH)" == "aarch64" ]] && echo "aarch64" || echo "amd64" ) +SUFFIX ?= "" # make the shell scripts as phony so that always replace with newer one .PHONY: scripts clean @@ -32,7 +32,7 @@ scripts: tiflash-env tiflash-env-$(ARCH).tar.xz: scripts # Add the z to modify the selinux label of the host file or directory being mounted into the container. # Reference: https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label - $(DOCKER) run --rm -v $(MOUNT):/tiflash-env:z hub.pingcap.net/tiflash/tiflash-llvm-base:$(DOCKER_TAG) /tiflash-env/prepare-sysroot.sh + $(DOCKER) run --rm -v $(MOUNT):/tiflash-env:z hub.pingcap.net/tiflash/tiflash-llvm-base:rocky8$(SUFFIX) /tiflash-env/prepare-sysroot.sh tar -cvaf tiflash-env-$(ARCH).tar.xz tiflash-env clean: diff --git a/release-centos7-llvm/env/README.md b/release-linux-llvm/env/README.md similarity index 88% rename from release-centos7-llvm/env/README.md rename to release-linux-llvm/env/README.md index a1e199ea697..984b0051901 100644 --- a/release-centos7-llvm/env/README.md +++ b/release-linux-llvm/env/README.md @@ -5,7 +5,7 @@ Scripts to build a toolchain sysroot (with cmake, clang, ccache, go) for buildin Usage: ``` -make tiflash-env-x86_64.tar.xz +SUFFIX=-llvm-17.0.6 make tiflash-env-x86_64.tar.xz tar xvf tiflash-env-x86_64.tar.xz # Now you can add the env variables to your init script to diff --git a/release-centos7-llvm/env/loader b/release-linux-llvm/env/loader similarity index 100% rename from release-centos7-llvm/env/loader rename to release-linux-llvm/env/loader diff --git a/release-centos7-llvm/env/loader-env-dump b/release-linux-llvm/env/loader-env-dump similarity index 100% rename from release-centos7-llvm/env/loader-env-dump rename to release-linux-llvm/env/loader-env-dump diff --git a/release-centos7-llvm/env/prepare-sysroot.sh b/release-linux-llvm/env/prepare-sysroot.sh similarity index 89% rename from release-centos7-llvm/env/prepare-sysroot.sh rename to release-linux-llvm/env/prepare-sysroot.sh index 391588c2527..4b201254f07 100755 --- a/release-centos7-llvm/env/prepare-sysroot.sh +++ b/release-linux-llvm/env/prepare-sysroot.sh @@ -17,11 +17,9 @@ set -ueox pipefail CMAKE_VERSION="3.24.2" -GO_VERSION="1.21.5" ARCH=$(uname -m) -GO_ARCH=$([[ "${ARCH}" == "aarch64" ]] && echo "arm64" || echo "amd64") LLVM_VERSION="17.0.6" -CCACHE_VERSION="4.5.1" +CCACHE_VERSION="4.10.2" SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" SYSROOT="${SCRIPTPATH}/sysroot" OPENSSL_VERSION="1_1_1w" @@ -85,14 +83,6 @@ function install_openssl() { rm -rf OpenSSL_${OPENSSL_VERSION}.tar.gz } -function install_go() { - wget "https://go.dev/dl/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz" - tar -C "${SYSROOT}" -xzvf go${GO_VERSION}.linux-${GO_ARCH}.tar.gz - mv "${SYSROOT}/go" "${SYSROOT}/go${GO_VERSION}" && \ - pushd "${SYSROOT}" && ln -sv "go${GO_VERSION}" "go" && popd - rm -rf go${GO_VERSION}.linux-${GO_ARCH}.tar.gz -} - function install_ccache() { wget "https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}.tar.gz" tar xvaf "ccache-${CCACHE_VERSION}.tar.gz" && rm -rf "ccache-${CCACHE_VERSION}.tar.gz" @@ -115,7 +105,6 @@ mkdir -p ${SYSROOT} install_cmake install_llvm install_openssl -install_go install_ccache # some extra steps diff --git a/release-centos7-llvm/env/tiflash-linker b/release-linux-llvm/env/tiflash-linker similarity index 100% rename from release-centos7-llvm/env/tiflash-linker rename to release-linux-llvm/env/tiflash-linker diff --git a/release-centos7-llvm/gen_coverage.sh b/release-linux-llvm/gen_coverage.sh similarity index 100% rename from release-centos7-llvm/gen_coverage.sh rename to release-linux-llvm/gen_coverage.sh diff --git a/release-centos7-llvm/scripts/build-asan.sh b/release-linux-llvm/scripts/build-asan.sh similarity index 100% rename from release-centos7-llvm/scripts/build-asan.sh rename to release-linux-llvm/scripts/build-asan.sh diff --git a/release-centos7-llvm/scripts/build-debug.sh b/release-linux-llvm/scripts/build-debug.sh similarity index 100% rename from release-centos7-llvm/scripts/build-debug.sh rename to release-linux-llvm/scripts/build-debug.sh diff --git a/release-centos7-llvm/scripts/build-release.sh b/release-linux-llvm/scripts/build-release.sh similarity index 100% rename from release-centos7-llvm/scripts/build-release.sh rename to release-linux-llvm/scripts/build-release.sh diff --git a/release-centos7-llvm/scripts/build-tiflash-release.sh b/release-linux-llvm/scripts/build-tiflash-release.sh similarity index 94% rename from release-centos7-llvm/scripts/build-tiflash-release.sh rename to release-linux-llvm/scripts/build-tiflash-release.sh index 799e76beb86..3ad9af4f8c6 100755 --- a/release-centos7-llvm/scripts/build-tiflash-release.sh +++ b/release-linux-llvm/scripts/build-tiflash-release.sh @@ -53,15 +53,15 @@ NPROC=${NPROC:-$(nproc || grep -c ^processor /proc/cpuinfo)} ENABLE_THINLTO=${ENABLE_THINLTO:-ON} ENABLE_PCH=${ENABLE_PCH:-ON} -INSTALL_DIR="${SRCPATH}/release-centos7-llvm/tiflash" +INSTALL_DIR="${SRCPATH}/release-linux-llvm/tiflash" rm -rf ${INSTALL_DIR} && mkdir -p ${INSTALL_DIR} if [ $CMAKE_BUILD_TYPE == "RELWITHDEBINFO" ]; then - BUILD_DIR="$SRCPATH/release-centos7-llvm/build-release" + BUILD_DIR="$SRCPATH/release-linux-llvm/build-release" ENABLE_FAILPOINTS="OFF" JEMALLOC_NARENAS="-1" else - BUILD_DIR="$SRCPATH/release-centos7-llvm/build-debug" + BUILD_DIR="$SRCPATH/release-linux-llvm/build-debug" ENABLE_FAILPOINTS="ON" JEMALLOC_NARENAS="40" fi diff --git a/release-centos7-llvm/scripts/build-tsan.sh b/release-linux-llvm/scripts/build-tsan.sh similarity index 100% rename from release-centos7-llvm/scripts/build-tsan.sh rename to release-linux-llvm/scripts/build-tsan.sh diff --git a/release-centos7-llvm/scripts/fix_compile_commands.py b/release-linux-llvm/scripts/fix_compile_commands.py similarity index 100% rename from release-centos7-llvm/scripts/fix_compile_commands.py rename to release-linux-llvm/scripts/fix_compile_commands.py diff --git a/release-centos7-llvm/scripts/perf-autofdo-llvm.py b/release-linux-llvm/scripts/perf-autofdo-llvm.py similarity index 100% rename from release-centos7-llvm/scripts/perf-autofdo-llvm.py rename to release-linux-llvm/scripts/perf-autofdo-llvm.py diff --git a/release-centos7-llvm/scripts/run-clang-tidy.py b/release-linux-llvm/scripts/run-clang-tidy.py similarity index 100% rename from release-centos7-llvm/scripts/run-clang-tidy.py rename to release-linux-llvm/scripts/run-clang-tidy.py