2020-04-03 13:23:32 +00:00
---
2022-03-29 14:26:35 +00:00
sidebar_position: 67
sidebar_label: Build on Linux for AARCH64 (ARM64)
2020-04-03 13:23:32 +00:00
---
2022-03-29 14:26:35 +00:00
# How to Build ClickHouse on Linux for AARCH64 (ARM64) Architecture
2019-12-02 14:00:21 +00:00
2022-03-29 14:26:35 +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.
2019-12-02 14:00:21 +00:00
2020-06-18 08:24:31 +00:00
The cross-build for AARCH64 is based on the [Build instructions ](../development/build.md ), follow them first.
2019-12-02 14:00:21 +00:00
2021-10-11 11:52:31 +00:00
## Install Clang-13
2019-12-02 14:00:21 +00:00
2021-10-11 11:53:12 +00:00
Follow the instructions from https://apt.llvm.org/ for your Ubuntu or Debian setup or do
```
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
```
2019-12-02 14:00:21 +00:00
2020-07-20 14:34:44 +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-07-20 14:34:44 +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
2021-10-11 11:52:44 +00:00
CC=clang-13 CXX=clang++-13 cmake . -Bbuild-arm64 -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-aarch64.cmake
2019-12-02 14:00:21 +00:00
ninja -C build-arm64
```
The resulting binary will run only on Linux with the AARCH64 CPU architecture.