Skip to main content
This topic describes how to compile StarRocks on the Ubuntu operating system. StarRocks supports compilation on both x86_64 and AArch64 architectures. Note Build StarRocks v4.1 and earlier on Ubuntu 22.04, and StarRocks v4.2 and later on Ubuntu 24.04.

Prerequisites

Install Dependencies

Run the following commands to install necessary dependencies:

Install Compiler

If you are using Ubuntu 22.04 or later, run the following command to install the tools and compilers:
If you are using an Ubuntu version earlier than 22.04, run the following commands to check the versions of tools and compilers:
  1. Check GCC/G++ versions:
    GCC/G++ versions must be 10.3 or later. If you are using earlier versions, click here to install GCC/G++.
  2. Check JDK version:
    OpenJDK version must be 17 or later. If you are using an earlier version, click here to install OpenJDK.
  3. Check CMake version:
    CMake version must be 3.20.1 or later. If you are using an earlier version, click here to install CMake.

Compile StarRocks

Download Source Code

Run the following command to clone the StarRocks repository and navigate into the directory:

Build StarRocks

Run the following command to start the compilation:
The default compilation parallelism is equal to CPU core count/4. Assuming you have 32 CPU cores, the default parallelism is 8. If you want to adjust the parallelism, you can specify the number of CPU cores to be used for compilation via -j in the command line. The following example uses 24 CPU cores for compilation:

FAQ

Q-1: Building aws_cpp_sdk fails on Ubuntu 20.04 with the error “Error: undefined reference to pthread_create”. How can I resolve this? A: This error occurs due to a lower version of CMake. Please upgrade CMake to version 3.20.1 or above. Q-2: Building StarRocks fails on Ubuntu 24.04 or GCC 12+ with strict warning errors. How can I resolve this? A: To prevent build failures in third-party libraries, export the following flag before building: