Configuring the Compilation Environment
Before compiling Doris, install dependencies and configure environment variables. In this document, the source code and dependency installation directories use opt/tools/installed/ as an example. If the directory does not exist, create it first.
Hardware Environment
Table 1 shows the compiler hardware configurations.
Software Environment
Table 2 shows the compiler software configurations.
Installing JDK
- Optional: Create an installation directory.
mkdir -p /opt/tools/installed
- Go to the installation directory.
1cd /opt/tools/installed
- Download JDK 8.
1wget https://doris-thirdparty-repo.bj.bcebos.com/thirdparty/jdk-8u291-linux-aarch64.tar.gz - Decompress the software package.
1tar -zxvf jdk-8u291-linux-aarch64.tar.gz
Installing Maven
- Go to the installation directory.
1cd /opt/tools/installed
- Download Maven 3.6.3.
1wget https://doris-thirdparty-repo.bj.bcebos.com/thirdparty/apache-maven-3.6.3-bin.tar.gz - Decompress the software package.
1tar -zxvf apache-maven-3.6.3-bin.tar.gz
Installing CMake
- Go to the installation directory.
1cd /opt/tools/installed
- Download CMake 3.28.0.
1 2
wget https://github.com/Kitware/CMake/archive/refs/tags/v3.28.0.zip mv v3.28.0.zip ./CMake-3.28.0.zip
- Decompress the software package.
1unzip CMake-3.28.0.zip - Run the configure script.
1 2
cd CMake-3.28.0 ./configure --prefix=/opt/tools/installed/CMake-3.28.0/build
- Compile and install CMake.
1 2
gmake gmake install - Add environment variables.
1export PATH=/opt/tools/installed/CMake-3.28.0/build/bin:$PATH
- Check whether the CMake version is 3.28.0.
1cmake --version
Installing Ninja
- Go to the installation directory.
1cd /opt/tools/installed
- Download Ninja 1.12.1.
1wget https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux-aarch64.zip - Decompress the software package.
1unzip ninja-linux-aarch64.zip -d ninja
- Add environment variables.
1export PATH=/opt/tools/installed/ninja:$PATH
- Check whether the Ninja version is 1.12.1.
1ninja --version
Installing Clang
- Go to the installation directory.
1cd /opt/tools/installed
- Download Clang 17.
1 2
wget https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-17.0.6.tar.gz mv llvmorg-17.0.6.tar.gz ./llvm-project-llvmorg-17.0.6.tar.gz
- Decompress the software package.
1tar -zxvf llvm-project-llvmorg-17.0.6.tar.gz
- Create an installation directory and go to the directory.
1 2 3
mkdir -p /opt/tools/installed/llvm-project-llvmorg-17.0.6/build/llvm mkdir -p /opt/tools/installed/llvm-project-llvmorg-17.0.6/install cd /opt/tools/installed/llvm-project-llvmorg-17.0.6/build/llvm
- Generate the LLVM build file.
1 2 3 4 5 6 7 8 9
cmake -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/opt/tools/installed/llvm-project-llvmorg-17.0.6/install \ -DCMAKE_C_COMPILER=gcc \ -DCMAKE_CXX_COMPILER=g++ \ -DLLVM_ENABLE_PROJECTS="clang;lld;bolt;openmp;clang-tools-extra" \ -DLLVM_ENABLE_RUNTIMES="compiler-rt;libunwind;libcxx;libcxxabi" \ -DLLVM_TARGETS_TO_BUILD="AArch64" \ /opt/tools/installed/llvm-project-llvmorg-17.0.6/llvm || exit 1
- Use 96 threads to build the LLVM project in parallel and perform installation.
1 2
ninja -j96 ninja install
- Add environment variables.
1export PATH=/opt/tools/installed/llvm-project-llvmorg-17.0.6/install/bin:$PATH
- Check whether the Clang version is 17.0.6.
1clang --version
Installing GCC
- Go to the installation directory.
1cd /opt/tools/installed
- Download GCC 12.
1wget https://eulermaker.compass-ci.openeuler.openatom.cn/api/repositories/gcc-for-openEuler/centos%3A7.6.1810/aarch64/history/902f83f6-2280-11ef-992d-3e91e18f8c69/last/Packages/gcc-for-openEuler-1.0.7-10.aarch64.rpm - Install the software package. Move the obtained GCC 12 software package to the /opt/tools/installed/ directory, and go to the directory.
1 2 3
rpm -i gcc-for-openEuler-1.0.7-10.aarch64.rpm mv /gcc-12.3.1-2024.05-aarch64-linux.tar.gz /opt/tools/installed/ cd /opt/tools/installed
- Decompress the package.
1tar -zxvf gcc-12.3.1-2024.05-aarch64-linux.tar.gz
- Add environment variables.
1export PATH=/opt/tools/installed/gcc-12.3.1-2024.05-aarch64-linux/bin:$PATH
- Check whether the GCC version is 12.3.1.
1gcc --version
Installing Autoconf
- Install the system software package.
1sudo yum install -y byacc patch automake libtool make which file ncurses-devel gettext-devel unzip bzip2 zip util-linux wget git python
- Install Autoconf 2.69.
- Download and decompress the installation package.
1 2
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz tar zxf autoconf-2.69.tar.gz
- Go to the software directory.
1cd autoconf-2.69
- Compile and install the software package.
1 2 3
./configure make make install
- Download and decompress the installation package.
Configuring Environment Variables
- Open the /etc/profile file.
1vi /etc/profile - Press i to enter the insert mode and add the following environment variable configurations to the end of the file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
export MAVEN_HOME=/opt/tools/installed/apache-maven-3.6.3 export PATH=$MAVEN_HOME/bin:$PATH export JAVA_HOME=/opt/tools/installed/jdk1.8.0_291 export PATH=$JAVA_HOME/bin:$PATH export CMAKE_HOME=/opt/tools/installed/CMake-3.28.0/build export PATH=$CMAKE_HOME/bin:$PATH export NINJA_HOME=/opt/tools/installed/ninja export PATH=$NINJA_HOME:$PATH export LLVM_HOME=/opt/tools/installed/llvm-project-llvmorg-17.0.6/install export PATH=$LLVM_HOME/bin:$PATH export GCC12_HOME=/opt/tools/installed/gcc-12.3.1-2024.05-aarch64-linux export PATH=$GCC12_HOME/bin:$PATH export LD_LIBRARY_PATH=$GCC12_HOME/lib64:$LLVM_HOME/lib:$LLVM_HOME/lib/aarch64-unknown-linux-gnu:$LD_LIBRARY_PATH export USE_AVX2=OFF export USE_UNWIND=OFF
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Enable the environment variables.
1source /etc/profile
Parent topic: Software Compilation