2024-03-15 03:11:24 +00:00
---
slug: /en/development/build-cross-loongarch
sidebar_position: 70
2024-05-16 09:40:34 +00:00
title: How to Build ClickHouse on Linux for LoongArch64 Architecture
sidebar_label: Build on Linux for LoongArch64
2024-03-15 03:11:24 +00:00
---
As of writing (2024/03/15) building for loongarch considered to be highly experimental. Not all features can be enabled.
2024-05-16 09:40:34 +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 LoongArch64 CPU architecture. This is intended for continuous integration checks that run on Linux servers.
2024-03-15 03:11:24 +00:00
2024-05-16 09:40:34 +00:00
The cross-build for LoongArch64 is based on the [Build instructions ](../development/build.md ), follow them first.
2024-03-15 03:11:24 +00:00
2024-10-15 16:24:06 +00:00
## Install Clang-19
2024-03-15 03:11:24 +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)"
```
## Build ClickHouse {#build-clickhouse}
2024-10-15 16:24:06 +00:00
The llvm version required for building must be greater than or equal to 19.1.0.
2024-03-15 03:11:24 +00:00
``` bash
cd ClickHouse
mkdir build-loongarch64
2024-10-15 16:24:06 +00:00
CC=clang-19 CXX=clang++-19 cmake . -Bbuild-loongarch64 -G Ninja -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-loongarch64.cmake
2024-03-15 03:11:24 +00:00
ninja -C build-loongarch64
```
2024-05-16 09:40:34 +00:00
The resulting binary will run only on Linux with the LoongArch64 CPU architecture.