Skip to main content
Version: 1.0

Compile on ARM platform

Compile and Run Doris on ARM64 + KylinOS.

This document describes how to compile Doris on the ARM64 platform.

Note that this document is only a guide document. Other errors may occur when compiling in different environments.

Software and hardware environment

  1. KylinOS version:

    $> cat /etc/.kyinfo
    time=2020-07-11 17:16:54
    dist_id=Kylin-Server-10-SP1-Release-Build04-20200711-arm64-2020-07-11 17:16:54
  2. CPU model

    $> cat /proc/cpuinfo
    model name: Phytium,FT-2000+/64
  3. Doris version

    commit 68bab73

Compilation tool installation (no network)

In the example, all tools are installed in the /home/doris/tools/installed/ directory.

Please obtain the required installation package first under network conditions.

1. Install gcc10

Download gcc-10.1.0


After unzipping, check the dependencies in contrib/download_prerequisites and download:

Unzip these four dependencies, then move to the gcc-10.1.0 source directory and rename them to gmp, isl, mpc, mpfr.

Download and install automake-1.15 (because gcc10 will find automake 1.15 version during compilation)
tar xzf automake-1.15.tar.gz
./configure --prefix=/home/doris/tools/installed
make && make install
export PATH=/home/doris/tools/installed/bin:$PATH

Compile GCC10:

cd gcc-10.1.0
./configure --prefix=/home/doris/tools/installed
make -j && make install

Compile time is longer.

2. Install other compilation components

  1. jdk-8u291-linux-aarch64.tar.gz

    No need to compile, just use it out of the box.

  2. cmake-3.19.8-Linux-aarch64.tar.gz

    No need to compile, just use it out of the box

  3. apache-maven-3.8.1-bin.tar.gz

    No need to compile, just use it out of the box

  4. nodejs 16.3.0

    No need to compile, just use it out of the box

  5. libtool-2.4.6.tar.gz

    For compiling third-party components, although the system may come with libtool, libtool needs to be together with automake, so it is not easy to cause problems.
    cd libtool-2.4.6/
    ./configure --prefix=/home/doris/tools/installed
    make -j && make install
  6. binutils-2.36.tar.xz (obtain bdf.h)
    ./configure --prefix=/home/doris/tools/installed
    make -j && make install
  7. Libiberty (for compiling BE)

    The source code of this library is under the source code package of gcc-10.1.0

    cd gcc-10.1.0/libiberty/
    ./configure --prefix=/home/doris/tools/installed

    After compilation, libiberty.a will be generated, which can be moved to the lib64 directory of Doris' thirdparty.

3. Compile third-party libraries

Suppose Doris source code is under /home/doris/doris-src/.

  1. Manually download all third-party libraries and place them in the thirdparty/src directory.

  2. Add in the Doris source directory and add the following content

    export DORIS_THIRDPARTY=/home/doris/doris-src/thirdparty/
    export JAVA_HOME=/home/doris/tools/jdk1.8.0_291/
    export DORIS_GCC_HOME=/home/doris/tools/installed/
    export PATCH_COMPILER_RT=true

    Pay attention to replace the corresponding directory

  3. Modify part of the content in

    1. Close build_mysql and build_libhdfs3

      mysql is no longer needed. However, libhdfs3 does not support arm architecture for the time being, so running Doris in arm does not support direct access to hdfs through libhdfs3, and requires a broker.

    2. Add the configure parameter in build_curl: --without-libpsl. If it is not added, an error may be reported during the linking phase of the final compilation of Doris BE: undefined reference to ‘psl_is_cookie_domain_acceptable'

  4. Execute Here are only possible errors

    • error: narrowing conversion of'-1' from'int' to'char' [-Wnarrowing]

      There will be an error when compiling brpc 0.9.7. The solution is to add -Wno-narrowing in CMAKE_CXX_FLAGS of CMakeLists.txt of brpc. This problem has been fixed in the brpc master code:

    • libz.a(deflate.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol z_errmsg' which may bind externally can not be used when making a shared object; recompile with -fPIC`

      There will be errors when compiling brpc 0.9.7, and libcrypto will also report similar errors. The reason is unknown. It seems that under aarch64, brpc needs to link the dynamic zlib and crypto libraries. But when we compile these two third-party libraries, we only compiled .a static files. Solution: Recompile zlib and openssl to generate .so dynamic library:

      Open, find the build_zlib function, and change:

      ./configure --prefix=$TP_INSTALL_DIR --static
      Just change to
      ./configure --prefix=$TP_INSTALL_DIR

      Find build_openssl and comment out the following parts:

      #if [-f $TP_INSTALL_DIR/lib64/ ]; then
      # rm -rf $TP_INSTALL_DIR/lib64/*
      #if [-f $TP_INSTALL_DIR/lib64/ ]; then
      # rm -rf $TP_INSTALL_DIR/lib64/*

      Then go to, comment out other build_xxx, open only build_zlib and build_openssl, and build_brpc and later build_xxx. Then re-execute

    • The compilation is stuck at a certain stage.

      Not sure why. Solution: Rerun can be executed repeatedly.

4. Compile Doris source code

Execute sh

5. FAQ

  1. undefined reference to psl_free appears when compiling Doris

    libcurl will call libpsl functions, but libpsl is not linked for an unknown reason. Solutions (choose one of the two):

    1. Add --without-libpsl to the build_curl method in thirdparty/, recompile libcurl, and then recompile Doris.
    2. About line 603 in be/CMakeLists.txt, add -lpsl after -pthread, and then recompile Doris.