2020-04-03 13:23:32 +00:00
---
toc_priority: 67
toc_title: How to Build ClickHouse on Linux for AARCH64 (ARM64)
---
2020-03-20 10:10:48 +00:00
# How to Build ClickHouse on Linux for AARCH64 (ARM64) architecture {#how-to-build-clickhouse-on-linux-for-aarch64-arm64-architecture}
2019-12-02 14:00:21 +00:00
This is for the case when you have Linux machine and want to use it to build `clickhouse` binary that will run on another Linux machine with AARCH64 CPU architecture. This is intended for continuous integration checks that run on Linux servers.
The cross-build for AARCH64 is based on the [Build instructions ](build.md ), follow them first.
2020-03-20 10:10:48 +00:00
# Install Clang-8 {#install-clang-8}
2019-12-02 14:00:21 +00:00
Follow the instructions from https://apt.llvm.org/ for your Ubuntu or Debian setup.
For example, in Ubuntu Bionic you can use the following commands:
2020-03-20 10:10:48 +00:00
``` bash
2019-12-15 05:34:30 +00:00
echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" | sudo tee /etc/apt/sources.list.d/llvm.list
2019-12-15 05:34:58 +00:00
sudo apt-get update
2019-12-02 14:00:21 +00:00
sudo apt-get install clang-8
```
2020-03-20 10:10:48 +00:00
# Install Cross-Compilation Toolset {#install-cross-compilation-toolset}
2019-12-02 14:00:21 +00:00
2020-03-20 10:10:48 +00:00
``` bash
2019-12-02 14:00:21 +00:00
cd ClickHouse
2019-12-15 05:53:34 +00:00
mkdir -p build-aarch64/cmake/toolchain/linux-aarch64
2019-12-15 05:25:40 +00:00
wget 'https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz?revision=2e88a73f-d233-4f96-b1f4-d8b36e9bb0b9& la=en' -O gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz
2019-12-15 05:53:34 +00:00
tar xJf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz -C build-aarch64/cmake/toolchain/linux-aarch64 --strip-components=1
2019-12-02 14:00:21 +00:00
```
2020-03-20 10:10:48 +00:00
# Build ClickHouse {#build-clickhouse}
2019-12-02 14:00:21 +00:00
2020-03-20 10:10:48 +00:00
``` bash
2019-12-02 14:00:21 +00:00
cd ClickHouse
mkdir build-arm64
CC=clang-8 CXX=clang++-8 cmake . -Bbuild-arm64 -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-aarch64.cmake
ninja -C build-arm64
```
The resulting binary will run only on Linux with the AARCH64 CPU architecture.