Switch to clang/llvm 14

This commit is contained in:
Alexey Milovidov 2022-02-19 18:43:02 +01:00
parent 25c75649fe
commit aa8f282ad9
17 changed files with 42 additions and 52 deletions

View File

@ -6,7 +6,7 @@ FROM ubuntu:20.04
ARG apt_archive="http://archive.ubuntu.com"
RUN sed -i "s|http://archive.ubuntu.com|$apt_archive|g" /etc/apt/sources.list
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=13
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=14
RUN apt-get update \
&& apt-get install \

View File

@ -6,7 +6,7 @@ FROM ubuntu:20.04
ARG apt_archive="http://archive.ubuntu.com"
RUN sed -i "s|http://archive.ubuntu.com|$apt_archive|g" /etc/apt/sources.list
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=13
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=14
RUN apt-get update \
&& apt-get install ca-certificates lsb-release wget gnupg apt-transport-https \

View File

@ -196,10 +196,8 @@ if __name__ == "__main__":
parser.add_argument("--clickhouse-repo-path", default=os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, os.pardir))
parser.add_argument("--output-dir", required=True)
parser.add_argument("--build-type", choices=("debug", ""), default="")
parser.add_argument("--compiler", choices=("clang-11", "clang-11-darwin", "clang-11-darwin-aarch64", "clang-11-aarch64",
"clang-12", "clang-12-darwin", "clang-12-darwin-aarch64", "clang-12-aarch64",
"clang-13", "clang-13-darwin", "clang-13-darwin-aarch64", "clang-13-aarch64", "clang-13-ppc64le",
"clang-11-freebsd", "clang-12-freebsd", "clang-13-freebsd", "gcc-11"), default="clang-13")
parser.add_argument("--compiler", choices=("clang-14", "clang-14-darwin", "clang-14-darwin-aarch64", "clang-14-aarch64", "clang-14-ppc64le",
"clang-14-freebsd", "gcc-11"), default="clang-14")
parser.add_argument("--sanitizer", choices=("address", "thread", "memory", "undefined", ""), default="")
parser.add_argument("--split-binary", action="store_true")
parser.add_argument("--clang-tidy", action="store_true")

View File

@ -7,7 +7,7 @@ FROM clickhouse/test-util:$FROM_TAG
ARG apt_archive="http://archive.ubuntu.com"
RUN sed -i "s|http://archive.ubuntu.com|$apt_archive|g" /etc/apt/sources.list
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=13
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=14
RUN apt-get update \
&& apt-get install ca-certificates lsb-release wget gnupg apt-transport-https \

View File

@ -8,7 +8,7 @@ FROM clickhouse/binary-builder:$FROM_TAG
ARG apt_archive="http://archive.ubuntu.com"
RUN sed -i "s|http://archive.ubuntu.com|$apt_archive|g" /etc/apt/sources.list
RUN apt-get update && apt-get --yes --allow-unauthenticated install clang-13 libllvm13 libclang-13-dev libmlir-13-dev
RUN apt-get update && apt-get --yes --allow-unauthenticated install clang-14 libllvm14 libclang-14-dev libmlir-14-dev
# repo versions doesn't work correctly with C++17
# also we push reports to s3, so we add index.html to subfolder urls

View File

@ -7,7 +7,7 @@ FROM clickhouse/test-util:$FROM_TAG
ARG apt_archive="http://archive.ubuntu.com"
RUN sed -i "s|http://archive.ubuntu.com|$apt_archive|g" /etc/apt/sources.list
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=13
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=14
RUN apt-get update \
&& apt-get install ca-certificates lsb-release wget gnupg apt-transport-https \

View File

@ -12,8 +12,8 @@ stage=${stage:-}
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
echo "$script_dir"
repo_dir=ch
BINARY_TO_DOWNLOAD=${BINARY_TO_DOWNLOAD:="clang-13_debug_none_bundled_unsplitted_disable_False_binary"}
BINARY_URL_TO_DOWNLOAD=${BINARY_URL_TO_DOWNLOAD:="https://clickhouse-builds.s3.yandex.net/$PR_TO_TEST/$SHA_TO_TEST/clickhouse_build_check/$BINARY_TO_DOWNLOAD/clickhouse"}
BINARY_TO_DOWNLOAD=${BINARY_TO_DOWNLOAD:="clang-14_debug_none_bundled_unsplitted_disable_False_binary"}
BINARY_URL_TO_DOWNLOAD=${BINARY_URL_TO_DOWNLOAD:="https://clickhouse-builds.s3.amazonaws.com/$PR_TO_TEST/$SHA_TO_TEST/clickhouse_build_check/$BINARY_TO_DOWNLOAD/clickhouse"}
function clone
{

View File

@ -2,7 +2,7 @@
set -euo pipefail
CLICKHOUSE_PACKAGE=${CLICKHOUSE_PACKAGE:="https://clickhouse-builds.s3.yandex.net/$PR_TO_TEST/$SHA_TO_TEST/clickhouse_build_check/clang-13_relwithdebuginfo_none_bundled_unsplitted_disable_False_binary/clickhouse"}
CLICKHOUSE_PACKAGE=${CLICKHOUSE_PACKAGE:="https://clickhouse-builds.s3.amazonaws.com/$PR_TO_TEST/$SHA_TO_TEST/clickhouse_build_check/clang-14_relwithdebuginfo_none_bundled_unsplitted_disable_False_binary/clickhouse"}
CLICKHOUSE_REPO_PATH=${CLICKHOUSE_REPO_PATH:=""}

View File

@ -6,8 +6,8 @@ Minimal ClickHouse build example:
```bash
cmake .. \
-DCMAKE_C_COMPILER=$(which clang-13) \
-DCMAKE_CXX_COMPILER=$(which clang++-13) \
-DCMAKE_C_COMPILER=$(which clang-14) \
-DCMAKE_CXX_COMPILER=$(which clang++-14) \
-DCMAKE_BUILD_TYPE=Debug \
-DENABLE_CLICKHOUSE_ALL=OFF \
-DENABLE_CLICKHOUSE_SERVER=ON \

View File

@ -9,7 +9,7 @@ This is for the case when you have Linux machine and want to use it to build `cl
The cross-build for AARCH64 is based on the [Build instructions](../development/build.md), follow them first.
## Install Clang-13
## Install Clang-14 or newer
Follow the instructions from https://apt.llvm.org/ for your Ubuntu or Debian setup or do
```
@ -30,7 +30,7 @@ tar xJf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz -C build-aarch64/cma
``` bash
cd ClickHouse
mkdir build-arm64
CC=clang-13 CXX=clang++-13 cmake . -Bbuild-arm64 -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-aarch64.cmake
CC=clang-14 CXX=clang++-14 cmake . -Bbuild-arm64 -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-aarch64.cmake
ninja -C build-arm64
```

View File

@ -9,14 +9,14 @@ This is for the case when you have Linux machine and want to use it to build `cl
The cross-build for Mac OS X is based on the [Build instructions](../development/build.md), follow them first.
## Install Clang-13
## Install Clang-14
Follow the instructions from https://apt.llvm.org/ for your Ubuntu or Debian setup.
For example the commands for Bionic are like:
``` bash
sudo echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-13 main" >> /etc/apt/sources.list
sudo apt-get install clang-13
sudo echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-14 main" >> /etc/apt/sources.list
sudo apt-get install clang-14
```
## Install Cross-Compilation Toolset {#install-cross-compilation-toolset}

View File

@ -23,7 +23,7 @@ sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
``` bash
cd ClickHouse
mkdir build-riscv64
CC=clang-13 CXX=clang++-13 cmake . -Bbuild-riscv64 -G Ninja -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-riscv64.cmake -DGLIBC_COMPATIBILITY=OFF -DENABLE_LDAP=OFF -DOPENSSL_NO_ASM=ON -DENABLE_JEMALLOC=ON -DENABLE_PARQUET=OFF -DENABLE_ORC=OFF -DUSE_UNWIND=OFF -DENABLE_GRPC=OFF -DENABLE_HDFS=OFF -DENABLE_MYSQL=OFF
CC=clang-14 CXX=clang++-14 cmake . -Bbuild-riscv64 -G Ninja -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-riscv64.cmake -DGLIBC_COMPATIBILITY=OFF -DENABLE_LDAP=OFF -DOPENSSL_NO_ASM=ON -DENABLE_JEMALLOC=ON -DENABLE_PARQUET=OFF -DENABLE_ORC=OFF -DUSE_UNWIND=OFF -DENABLE_GRPC=OFF -DENABLE_HDFS=OFF -DENABLE_MYSQL=OFF
ninja -C build-riscv64
```

View File

@ -76,7 +76,7 @@ The build requires the following components:
- Git (is used only to checkout the sources, its not needed for the build)
- CMake 3.10 or newer
- Ninja
- C++ compiler: clang-13 or newer
- C++ compiler: clang-14 or newer
- Linker: lld
If all the components are installed, you may build in the same way as the steps above.

View File

@ -154,7 +154,7 @@ While inside the `build` directory, configure your build by running CMake. Befor
export CC=clang CXX=clang++
cmake ..
If you installed clang using the automatic installation script above, also specify the version of clang installed in the first command, e.g. `export CC=clang-13 CXX=clang++-13`. The clang version will be in the script output.
If you installed clang using the automatic installation script above, also specify the version of clang installed in the first command, e.g. `export CC=clang-14 CXX=clang++-14`. The clang version will be in the script output.
The `CC` variable specifies the compiler for C (short for C Compiler), and `CXX` variable instructs which C++ compiler is to be used for building.

View File

@ -200,14 +200,6 @@ cmake -DUSE_DEBUG_HELPERS=1 -DUSE_STATIC_LIBRARIES=0 -DSPLIT_SHARED_LIBRARIES=1
В процессе сборки могут появится сообщения `libprotobuf WARNING` про protobuf файлы в библиотеке libhdfs2. Это не имеет значения.
В случае получения ошибок вида `error: variable 'y' set but not used [-Werror,-Wunused-but-set-variable]` ножно попробовать использовать другую версию компилятора сlang. Например, на момент написания данного текста описанная выше команда по установке clang для Ubuntu 20.04 по-умолчанию устанавливает clang-13, с которым возникает эта ошибка. Для решения проблемы можно установить clang-12 с помощью команд:
```bash
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 12
```
И далее использовать именно его, указав соответствующую версию при установке переменных окружения CC и CXX перед вызовом cmake.
При успешной сборке, вы получите готовый исполняемый файл `ClickHouse/build/programs/clickhouse`:
ls -l programs/clickhouse

View File

@ -1,7 +1,7 @@
{
"build_config": [
{
"compiler": "clang-13",
"compiler": "clang-14",
"build-type": "",
"sanitizer": "",
"package-type": "deb",
@ -12,7 +12,7 @@
"with_coverage": false
},
{
"compiler": "clang-13",
"compiler": "clang-14",
"build-type": "",
"sanitizer": "",
"package-type": "performance",
@ -32,7 +32,7 @@
"with_coverage": false
},
{
"compiler": "clang-13",
"compiler": "clang-14",
"build-type": "",
"sanitizer": "",
"package-type": "binary",
@ -45,7 +45,7 @@
"tests_config": {
"Testflows check": {
"required_build_properties": {
"compiler": "clang-13",
"compiler": "clang-14",
"package_type": "deb",
"build_type": "relwithdebuginfo",
"sanitizer": "none",
@ -57,7 +57,7 @@
},
"Release": {
"required_build_properties": {
"compiler": "clang-13",
"compiler": "clang-14",
"package_type": "deb",
"build_type": "relwithdebuginfo",
"sanitizer": "none",
@ -69,7 +69,7 @@
},
"ClickHouse Keeper Jepsen": {
"required_build_properties": {
"compiler": "clang-13",
"compiler": "clang-14",
"package_type": "binary",
"build_type": "relwithdebuginfo",
"sanitizer": "none",

View File

@ -8,7 +8,7 @@ BuildConfig = Dict[str, ConfValue]
CI_CONFIG = {
"build_config": {
"package_release": {
"compiler": "clang-13",
"compiler": "clang-14",
"build_type": "",
"sanitizer": "",
"package_type": "deb",
@ -19,7 +19,7 @@ CI_CONFIG = {
"with_coverage": False,
},
"performance": {
"compiler": "clang-13",
"compiler": "clang-14",
"build_type": "",
"sanitizer": "",
"package_type": "performance",
@ -39,7 +39,7 @@ CI_CONFIG = {
"with_coverage": False,
},
"package_aarch64": {
"compiler": "clang-13-aarch64",
"compiler": "clang-14-aarch64",
"build_type": "",
"sanitizer": "",
"package_type": "deb",
@ -50,7 +50,7 @@ CI_CONFIG = {
"with_coverage": False,
},
"package_asan": {
"compiler": "clang-13",
"compiler": "clang-14",
"build_type": "",
"sanitizer": "address",
"package_type": "deb",
@ -60,7 +60,7 @@ CI_CONFIG = {
"with_coverage": False,
},
"package_ubsan": {
"compiler": "clang-13",
"compiler": "clang-14",
"build_type": "",
"sanitizer": "undefined",
"package_type": "deb",
@ -70,7 +70,7 @@ CI_CONFIG = {
"with_coverage": False,
},
"package_tsan": {
"compiler": "clang-13",
"compiler": "clang-14",
"build_type": "",
"sanitizer": "thread",
"package_type": "deb",
@ -80,7 +80,7 @@ CI_CONFIG = {
"with_coverage": False,
},
"package_msan": {
"compiler": "clang-13",
"compiler": "clang-14",
"build_type": "",
"sanitizer": "memory",
"package_type": "deb",
@ -90,7 +90,7 @@ CI_CONFIG = {
"with_coverage": False,
},
"package_debug": {
"compiler": "clang-13",
"compiler": "clang-14",
"build_type": "debug",
"sanitizer": "",
"package_type": "deb",
@ -100,7 +100,7 @@ CI_CONFIG = {
"with_coverage": False,
},
"binary_release": {
"compiler": "clang-13",
"compiler": "clang-14",
"build_type": "",
"sanitizer": "",
"package_type": "binary",
@ -111,7 +111,7 @@ CI_CONFIG = {
"with_coverage": False,
},
"binary_tidy": {
"compiler": "clang-13",
"compiler": "clang-14",
"build_type": "debug",
"sanitizer": "",
"package_type": "binary",
@ -122,7 +122,7 @@ CI_CONFIG = {
"with_coverage": False,
},
"binary_splitted": {
"compiler": "clang-13",
"compiler": "clang-14",
"build_type": "",
"sanitizer": "",
"package_type": "binary",
@ -132,7 +132,7 @@ CI_CONFIG = {
"with_coverage": False,
},
"binary_darwin": {
"compiler": "clang-13-darwin",
"compiler": "clang-14-darwin",
"build_type": "",
"sanitizer": "",
"package_type": "binary",
@ -143,7 +143,7 @@ CI_CONFIG = {
"with_coverage": False,
},
"binary_aarch64": {
"compiler": "clang-13-aarch64",
"compiler": "clang-14-aarch64",
"build_type": "",
"sanitizer": "",
"package_type": "binary",
@ -154,7 +154,7 @@ CI_CONFIG = {
"with_coverage": False,
},
"binary_freebsd": {
"compiler": "clang-13-freebsd",
"compiler": "clang-14-freebsd",
"build_type": "",
"sanitizer": "",
"package_type": "binary",
@ -165,7 +165,7 @@ CI_CONFIG = {
"with_coverage": False,
},
"binary_darwin_aarch64": {
"compiler": "clang-13-darwin-aarch64",
"compiler": "clang-14-darwin-aarch64",
"build_type": "",
"sanitizer": "",
"package_type": "binary",
@ -176,7 +176,7 @@ CI_CONFIG = {
"with_coverage": False,
},
"binary_ppc64le": {
"compiler": "clang-13-ppc64le",
"compiler": "clang-14-ppc64le",
"build_type": "",
"sanitizer": "",
"package_type": "binary",