Build on Linux for s390x (zLinux)
ClickHouse has experimental support for s390x.
Building ClickHouse for s390x
s390x has two OpenSSL-related build options:
- By default, OpenSSL is build on s390x as a shared library. This is different from all other platforms, where OpenSSL is build as static library.
- To build OpenSSL as a static library regardless, pass
-DENABLE_OPENSSL_DYNAMIC=0
to CMake.
These instructions assume that the host machine is x86_64 and has all the tooling required to build natively based on the build instructions. It also assumes that the host is Ubuntu 22.04 but the following instructions should also work on Ubuntu 20.04.
In addition to installing the tooling used to build natively, the following additional packages need to be installed:
If you wish to cross compile rust code install the rust cross compile target for s390x:
The s390x build uses the mold linker, download it from https://github.com/rui314/mold/releases/download/v2.0.0/mold-2.0.0-x86_64-linux.tar.gz
and place it into your $PATH
.
To build for s390x:
Running
Once built, the binary can be run with, e.g.:
Debugging
Install LLDB:
To Debug a s390x executable, run clickhouse using QEMU in debug mode:
In another shell run LLDB and attach, replace <Clickhouse Parent Directory>
and <build directory>
with the values corresponding to your environment.
Visual Studio Code integration
- CodeLLDB extension is required for visual debugging.
- Command Variable extension can help dynamic launches if using CMake Variants.
- Make sure to set the backend to your LLVM installation eg.
"lldb.library": "/usr/lib/x86_64-linux-gnu/liblldb-15.so"
- Make sure to run the clickhouse executable in debug mode prior to launch. (It is also possible to create a
preLaunchTask
that automates this)
Example configurations
cmake-variants.yaml
launch.json
settings.json
This would also put different builds under different subfolders of the build
folder.
run-debug.sh
tasks.json
Defines a task to run the compiled executable in server
mode under a tmp
folder next to the binaries, with configuration from under programs/server/config.xml
.