`--build` need an option (`build`).
3.6 KiB
slug | sidebar_position | sidebar_label | title | description |
---|---|---|---|---|
/en/development/build | 64 | Build on Linux | How to Build ClickHouse on Linux | How to build ClickHouse on Linux |
Supported platforms:
- x86_64
- AArch64
- Power9 (experimental)
Building on Ubuntu
The following tutorial is based on Ubuntu Linux. With appropriate changes, it should also work on any other Linux distribution. The minimum recommended Ubuntu version for development is 22.04 LTS.
Install Prerequisites
sudo apt-get install git cmake ccache python3 ninja-build nasm yasm gawk
Install and Use the Clang compiler
On Ubuntu/Debian you can use LLVM's automatic installation script, see here.
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
Note: in case of troubles, you can also use this:
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
For other Linux distribution - check the availability of LLVM's prebuild packages.
As of April 2023, any version of Clang >= 15 will work. GCC as a compiler is not supported To build with a specific Clang version:
export CC=clang-15
export CXX=clang++-15
Checkout ClickHouse Sources
git clone --recursive --shallow-submodules git@github.com:ClickHouse/ClickHouse.git
or
git clone --recursive --shallow-submodules https://github.com/ClickHouse/ClickHouse.git
Build ClickHouse
cd ClickHouse
mkdir build
cmake -S . -B build
cmake --build build # or: `cd build; ninja`
To create an executable, run cmake --build build --target clickhouse
(or: cd build; ninja clickhouse
).
This will create executable build/programs/clickhouse
which can be used with client
or server
arguments.
Building on Any Linux
The build requires the following components:
- Git (used to checkout the sources, not needed for the build)
- CMake 3.20 or newer
- Compiler: Clang 15 or newer
- Linker: lld 15 or newer
- Ninja
- Yasm
- Gawk
If all the components are installed, you may build in the same way as the steps above.
Example for OpenSUSE Tumbleweed:
sudo zypper install git cmake ninja clang-c++ python lld nasm yasm gawk
git clone --recursive https://github.com/ClickHouse/ClickHouse.git
mkdir build
cmake -S . -B build
cmake --build build
Example for Fedora Rawhide:
sudo yum update
sudo yum --nogpg install git cmake make clang python3 ccache nasm yasm gawk
git clone --recursive https://github.com/ClickHouse/ClickHouse.git
mkdir build
cmake -S . -B build
cmake --build build
You Don’t Have to Build ClickHouse
ClickHouse is available in pre-built binaries and packages. Binaries are portable and can be run on any Linux flavour.
The CI checks build the binaries on each commit to ClickHouse. To download them:
- Open the commits list
- Choose a Merge pull request commit that includes the new feature, or was added after the new feature
- Click the status symbol (yellow dot, red x, green check) to open the CI check list
- Scroll through the list until you find ClickHouse build check x/x artifact groups are OK
- Click Details
- Find the type of package for your operating system that you need and download the files.