我要评分
获取效率
正确性
完整性
易理解

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.

Table 1 Recommended hardware configurations for the compiler

Item

Requirement

Processor

Kunpeng 920

Memory

32 GB or above

Drive

480 GB or above

Software Environment

Table 2 shows the compiler software configurations.

Table 2 Recommended software configurations for the compiler

Item

Software Version

OS

openEuler 22.03 LTS SP1

JDK

JDK 1.8.0_291

Maven

3.6.3

CMake

3.28.0

Ninja

1.12.1

Clang

17.0.6

GCC

12.3.1

Autoconf

2.69

Installing JDK

  1. Optional: Create an installation directory.
    mkdir -p /opt/tools/installed
  2. Go to the installation directory.
    1
    cd /opt/tools/installed
    
  3. Download JDK 8.
    1
    wget https://doris-thirdparty-repo.bj.bcebos.com/thirdparty/jdk-8u291-linux-aarch64.tar.gz
    
  4. Decompress the software package.
    1
    tar -zxvf jdk-8u291-linux-aarch64.tar.gz
    

Installing Maven

  1. Go to the installation directory.
    1
    cd /opt/tools/installed
    
  2. Download Maven 3.6.3.
    1
    wget https://doris-thirdparty-repo.bj.bcebos.com/thirdparty/apache-maven-3.6.3-bin.tar.gz
    
  3. Decompress the software package.
    1
    tar -zxvf apache-maven-3.6.3-bin.tar.gz
    

Installing CMake

  1. Go to the installation directory.
    1
    cd /opt/tools/installed
    
  2. 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
    
  3. Decompress the software package.
    1
    unzip CMake-3.28.0.zip
    
  4. Run the configure script.
    1
    2
    cd CMake-3.28.0
    ./configure --prefix=/opt/tools/installed/CMake-3.28.0/build
    
  5. Compile and install CMake.
    1
    2
    gmake
    gmake install
    
  6. Add environment variables.
    1
    export PATH=/opt/tools/installed/CMake-3.28.0/build/bin:$PATH
    
  7. Check whether the CMake version is 3.28.0.
    1
    cmake --version
    

Installing Ninja

  1. Go to the installation directory.
    1
    cd /opt/tools/installed
    
  2. Download Ninja 1.12.1.
    1
    wget https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux-aarch64.zip
    
  3. Decompress the software package.
    1
    unzip ninja-linux-aarch64.zip -d ninja
    
  4. Add environment variables.
    1
    export PATH=/opt/tools/installed/ninja:$PATH
    
  5. Check whether the Ninja version is 1.12.1.
    1
    ninja --version
    

Installing Clang

  1. Go to the installation directory.
    1
    cd /opt/tools/installed
    
  2. 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
    
  3. Decompress the software package.
    1
    tar -zxvf llvm-project-llvmorg-17.0.6.tar.gz
    
  4. 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
    
  5. 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
    
  6. Use 96 threads to build the LLVM project in parallel and perform installation.
    1
    2
    ninja -j96
    ninja install
    
  7. Add environment variables.
    1
    export PATH=/opt/tools/installed/llvm-project-llvmorg-17.0.6/install/bin:$PATH
    
  8. Check whether the Clang version is 17.0.6.
    1
    clang --version
    

Installing GCC

  1. Go to the installation directory.
    1
    cd /opt/tools/installed
    
  2. Download GCC 12.
    1
    wget 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
    
  3. 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
    
  4. Decompress the package.
    1
    tar -zxvf gcc-12.3.1-2024.05-aarch64-linux.tar.gz
    
  5. Add environment variables.
    1
    export PATH=/opt/tools/installed/gcc-12.3.1-2024.05-aarch64-linux/bin:$PATH
    
  6. Check whether the GCC version is 12.3.1.
    1
    gcc --version
    

Installing Autoconf

  1. Install the system software package.
    1
    sudo yum install -y byacc patch automake libtool make which file ncurses-devel gettext-devel unzip bzip2 zip util-linux wget git python
    
  2. Install Autoconf 2.69.
    1. 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
      
    2. Go to the software directory.
      1
      cd autoconf-2.69
      
    3. Compile and install the software package.
      1
      2
      3
      ./configure
      make
      make install
      

Configuring Environment Variables

  1. Open the /etc/profile file.
    1
    vi /etc/profile
    
  2. 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
    
  3. Press Esc, type :wq!, and press Enter to save the file and exit.
  4. Enable the environment variables.
    1
    source /etc/profile