Skip to content

Commit

Permalink
[GLUTEN-1963][CH] upgrade to clang-16 (facebookincubator#2073)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwz9103 authored Jun 26, 2023
1 parent 8f2c139 commit 51259ad
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
2 changes: 0 additions & 2 deletions cpp-ch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ add_custom_command(
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DENABLE_PROTOBUF=ON
-DENABLE_TESTS=ON
-DENABLE_CAPNP=OFF
-DENABLE_JEMALLOC=ON
-DENABLE_MULTITARGET_CODE=ON
-DENABLE_EXTERN_LOCAL_ENGINE=ON
Expand All @@ -65,7 +64,6 @@ add_custom_command(
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DENABLE_PROTOBUF=ON
-DENABLE_TESTS=OFF
-DENABLE_CAPNP=OFF
-DENABLE_JEMALLOC=ON
-DENABLE_MULTITARGET_CODE=ON
-DENABLE_EXTERN_LOCAL_ENGINE=ON
Expand Down
2 changes: 1 addition & 1 deletion cpp-ch/local-engine/docker/image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FROM ubuntu:20.04
ARG apt_archive="http://mirrors.aliyun.com"
RUN sed -i "s|http://archive.ubuntu.com|$apt_archive|g" /etc/apt/sources.list

ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=15
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=16

RUN apt-get update \
&& apt-get install \
Expand Down
6 changes: 3 additions & 3 deletions docs/get-started/ClickHouse.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ In general, we use IDEA for Gluten development and CLion for ClickHouse backend

Install the software required for compilation, run `sudo ./ep/build-clickhouse/src/install_ubuntu.sh`.
Under the hood, it will install the following software:
- Clang 15.0
- Clang 16.0
- cmake 3.20 or higher version
- ninja-build 1.8.2

Expand Down Expand Up @@ -66,15 +66,15 @@ Otherwise, do:
```shell
export GLUTEN_SOURCE=/path/to/gluten
export CH_SOURCE_DIR=/path/to/ClickHouse
cmake -G Ninja -S ${GLUTEN_SOURCE}/cpp-ch -B ${GLUTEN_SOURCE}/cpp-ch/build_ch -DCH_SOURCE_DIR=${CH_SOURCE_DIR} "-DCMAKE_C_COMPILER=$(command -v clang-15)" "-DCMAKE_CXX_COMPILER=$(command -v clang++-15)" "-DCMAKE_BUILD_TYPE=RelWithDebInfo"
cmake -G Ninja -S ${GLUTEN_SOURCE}/cpp-ch -B ${GLUTEN_SOURCE}/cpp-ch/build_ch -DCH_SOURCE_DIR=${CH_SOURCE_DIR} "-DCMAKE_C_COMPILER=$(command -v clang-16)" "-DCMAKE_CXX_COMPILER=$(command -v clang++-16)" "-DCMAKE_BUILD_TYPE=RelWithDebInfo"
```
Next, you need to compile Kyligence/Clickhouse. There are two options:
3. (Option 1) Use CLion
- Open ClickHouse repo
- Choose File -> Settings -> Build, Execution, Deployment -> Toolchains, and then choose Bundled CMake, clang-15 as C Compiler, clang++-15 as C++ Compiler:
- Choose File -> Settings -> Build, Execution, Deployment -> Toolchains, and then choose Bundled CMake, clang-16 as C Compiler, clang++-16 as C++ Compiler:
![ClickHouse-CLion-Toolchains](../image/ClickHouse/CLion-Configuration-1.png)
Expand Down
Binary file modified docs/image/ClickHouse/CLion-Configuration-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion ep/build-clickhouse/src/build_clickhouse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ done

echo ${GLUTEN_SOURCE}

cmake -G Ninja -S ${GLUTEN_SOURCE}/cpp-ch -B ${GLUTEN_SOURCE}/cpp-ch/build_ch -DCH_SOURCE_DIR=${CH_SOURCE_DIR} "-DCMAKE_C_COMPILER=$(command -v clang-15)" "-DCMAKE_CXX_COMPILER=$(command -v clang++-15)" "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
export CC=${CC:-clang-16}
export CXX=${CXX:-clang++-16}
cmake -G Ninja -S ${GLUTEN_SOURCE}/cpp-ch -B ${GLUTEN_SOURCE}/cpp-ch/build_ch -DCH_SOURCE_DIR=${CH_SOURCE_DIR} "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
cmake --build ${GLUTEN_SOURCE}/cpp-ch/build_ch --target build_ch
24 changes: 12 additions & 12 deletions ep/build-clickhouse/src/install_ubuntu.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash

echo "Install cmake and ninja"
apt install -y git cmake ccache python3 ninja-build yasm gawk
echo "Install llvm"
LLVM_VERSION=15
export LLVM_PUBKEY_HASH="bda960a8da687a275a2078d43c111d66b1c6a893a3275271beedf266c1ff4a0cdecb429c7a5cccf9f486ea7aa43fd27f"
wget -nv -O /tmp/llvm-snapshot.gpg.key https://apt.llvm.org/llvm-snapshot.gpg.key
echo "${LLVM_PUBKEY_HASH} /tmp/llvm-snapshot.gpg.key" | sha384sum -c
apt-key add /tmp/llvm-snapshot.gpg.key
export CODENAME="$(lsb_release --codename --short | tr 'A-Z' 'a-z')"
echo "deb [trusted=yes] http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${LLVM_VERSION} main" >> /etc/apt/sources.list

apt install -y llvm-${LLVM_VERSION} clang-${LLVM_VERSION}
# ref: https://clickhouse.com/docs/en/development/build

echo "Install Prerequisites"
sudo apt-get install git cmake ccache python3 ninja-build nasm yasm gawk lsb-release wget software-properties-common gnupg

echo "Install and Use the Clang compiler"
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"

echo "add CC and CXX to .bashrc"
echo "export CC=clang-16" >> ~/.bashrc
echo "export CXX=clang++-16" >> ~/.bashrc
source ~/.bashrc

0 comments on commit 51259ad

Please sign in to comment.