Compile Apache Doris on ARM Platforms
This document describes how to compile Apache Doris on ARM64 platforms, including hardware and operating system compatibility, dependency installation, and the build process.
This document is for guidance only. Other errors may occur in different ARM environments. You are welcome to report them or submit solutions in doris-website Issues.
Starting from version 3.0.3, the ARM platform supports compilation and deployment in compute-storage decoupled mode.
1. Hardware and Operating System Compatibility
The following environments have been verified by the community:
| Operating System | Version | Example CPU |
|---|---|---|
| KylinOS | Kylin-Server-10-SP1-Release-Build04-20200711 | Phytium FT-2000+/64 |
| CentOS | 7.9 and above (AltArch) | aarch64 |
| Ubuntu | 20.04 | aarch64 |
Reference output:
# KylinOS
$ cat /etc/.kyinfo
name=Kylin-Server
milestone=10-SP1-Release-Build04-20200711
arch=arm64
beta=False
time=2020-07-11 17:16:54
dist_id=Kylin-Server-10-SP1-Release-Build04-20200711-arm64-2020-07-11 17:16:54
$ cat /proc/cpuinfo
model name : Phytium,FT-2000+/64
# CentOS 7.9
$ lsb_release -a
LSB Version: :core-4.1-aarch64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.9.2009 (AltArch)
Release: 7.9.2009
Codename: AltArch
2. Software Environment Configuration
2.1 Dependency Version Reference Table (Using JDK 8 as an Example)
| Component | Version | Notes |
|---|---|---|
| Git | 2.0+ | |
| JDK | 1.8.0 | JDK 17 is required to compile 3.0+ or master |
| Maven | 3.6.3 | 3.9.9 is recommended |
| NodeJS | 16.3.0 | |
| LDB Toolchain | 0.9.1 | 0.21+ is recommended for ARM |
| autoconf | 2.69 | Install from source |
| bison | 3.0.4 | |
| Common system packages | Installed automatically by yum/apt | byacc, patch, automake, libtool, make, which, file, ncurses-devel, gettext-devel, unzip, bzip2, zip, util-linux, wget, git, python2 |
2.2 Commands to Install the Software Environment
- CentOS 7.9
- Ubuntu 20.04
- Create the root directories for downloaded packages and installed software
# Create the root directory for downloaded packages
mkdir /opt/tools
# Create the root directory for installed software
mkdir /opt/software
- Install dependencies
- Git
# To skip the compilation hassle, install directly with yum
yum install -y git
- JDK 8
# When compiling Doris 2.1 or earlier versions, you can install JDK 8
# Option 1: Install directly with yum. The devel package provides tools such as jps
yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel
# Option 2: Download the arm64 package, extract it, and configure environment variables
cd /opt/tools
wget https://doris-thirdparty-repo.bj.bcebos.com/thirdparty/jdk-8u291-linux-aarch64.tar.gz && \
tar -zxvf jdk-8u291-linux-aarch64.tar.gz && \
mv jdk1.8.0_291 /opt/software/jdk8
- JDK 17
# To compile Doris 3.0 (inclusive) or later versions, or the master branch, replace JDK 8 with JDK 17
yum install -y java-17-openjdk java-17-openjdk-devel
- Maven
cd /opt/tools
# Download, extract, and configure environment variables
wget https://dlcdn.apache.org/maven/maven-3/3.9.9/binaries/apache-maven-3.9.9-bin.tar.gz && \
tar -zxvf apache-maven-3.9.9-bin.tar.gz && \
mv apache-maven-3.9.9 /opt/software/maven
- NodeJS
cd /opt/tools
# Download the arm64 package
wget https://doris-thirdparty-repo.bj.bcebos.com/thirdparty/node-v16.3.0-linux-arm64.tar.xz && \
tar -xvf node-v16.3.0-linux-arm64.tar.xz && \
mv node-v16.3.0-linux-arm64 /opt/software/nodejs
- LDB Toolchain
cd /opt/tools
# Download the ARM version of LDB Toolchain
wget https://github.com/amosbird/ldb_toolchain_gen/releases/download/v0.21/ldb_toolchain_gen.aarch64.sh && \
sh ldb_toolchain_gen.aarch64.sh /opt/software/ldb_toolchain/
- Configure environment variables
# Configure environment variables (using JDK 8 as an example)
vim /etc/profile.d/doris.sh
export JAVA_HOME=/opt/software/jdk8
export MAVEN_HOME=/opt/software/maven
export NODE_JS_HOME=/opt/software/nodejs
export LDB_HOME=/opt/software/ldb_toolchain
export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$NODE_JS_HOME/bin:$LDB_HOME/bin:$PATH
# Save, exit, and refresh environment variables
source /etc/profile.d/doris.sh
# Verify the installation (using JDK 8 as an example)
java -version
> java version "1.8.0_291"
mvn -version
> Apache Maven 3.9.9
node --version
> v16.3.0
gcc --version
> gcc-11
- Install additional environments and components
# Install common system packages
sudo yum install -y byacc patch automake libtool make which file ncurses-devel gettext-devel unzip bzip2 bison zip util-linux wget git python2
# Install autoconf-2.69
cd /opt/tools
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz && \
tar zxf autoconf-2.69.tar.gz && \
mv autoconf-2.69 /opt/software/autoconf && \
cd /opt/software/autoconf && \
./configure && \
make && \
make install
- Update the apt software source
apt-get update
- Check the shell command set
On Ubuntu, /bin/sh points to dash rather than bash by default. You need to switch it to bash so that some scripts can run. First, check what sh currently points to:
ls -al /bin/sh
Switch it with the following command:
sudo dpkg-reconfigure dash
In the interactive interface, select no (do not set dash as the default shell), and /bin/sh will point to bash.
- Create the root directories for downloaded packages and installed software
# Create the root directory for downloaded packages
mkdir /opt/tools
# Create the root directory for installed software
mkdir /opt/software
- Install dependencies
- Git
# Install directly with apt-get
apt-get -y install git
- JDK 8
# Download the arm64 package, extract it, and configure environment variables
cd /opt/tools
wget https://doris-thirdparty-repo.bj.bcebos.com/thirdparty/jdk-8u291-linux-aarch64.tar.gz && \
tar -zxvf jdk-8u291-linux-aarch64.tar.gz && \
mv jdk1.8.0_291 /opt/software/jdk8
- JDK 17
# To compile Doris 3.0 (inclusive) or later versions, or the master branch, replace JDK 8 with JDK 17
apt-get -y install openjdk-17-jdk
- Maven
cd /opt/tools
# Download, extract, and configure environment variables
wget https://dlcdn.apache.org/maven/maven-3/3.9.9/binaries/apache-maven-3.9.9-bin.tar.gz && \
tar -zxvf apache-maven-3.9.9-bin.tar.gz && \
mv apache-maven-3.9.9 /opt/software/maven
- NodeJS
cd /opt/tools
# Download the arm64 package
wget https://doris-thirdparty-repo.bj.bcebos.com/thirdparty/node-v16.3.0-linux-arm64.tar.xz && \
tar -xvf node-v16.3.0-linux-arm64.tar.xz && \
mv node-v16.3.0-linux-arm64 /opt/software/nodejs
- LDB Toolchain
cd /opt/tools
# Download the ARM version of LDB Toolchain
wget https://github.com/amosbird/ldb_toolchain_gen/releases/download/v0.21/ldb_toolchain_gen.aarch64.sh && \
sh ldb_toolchain_gen.aarch64.sh /opt/software/ldb_toolchain/
- Configure environment variables
# Configure environment variables (using JDK 8 as an example)
vim /etc/profile.d/doris.sh
export JAVA_HOME=/opt/software/jdk8
export MAVEN_HOME=/opt/software/maven
export NODE_JS_HOME=/opt/software/nodejs
export LDB_HOME=/opt/software/ldb_toolchain
export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$NODE_JS_HOME/bin:$LDB_HOME/bin:$PATH
# Save, exit, and refresh environment variables
source /etc/profile.d/doris.sh
# Verify the installation (using JDK 8 as an example)
java -version
> java version "1.8.0_291"
mvn -version
> Apache Maven 3.9.9
node --version
> v16.3.0
gcc --version
> gcc-11
- Install additional environments and components
# Install common system packages
sudo apt install -y build-essential cmake flex automake bison binutils-dev libiberty-dev zip libncurses5-dev curl ninja-build
sudo apt-get install -y make
sudo apt-get install -y unzip
sudo apt-get install -y python2
sudo apt-get install -y byacc
sudo apt-get install -y automake
sudo apt-get install -y libtool
sudo apt-get install -y bzip2
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
sudo apt update
sudo apt install gcc-11 g++-11
sudo apt-get -y install autoconf autopoint
# Install autoconf-2.69
cd /opt/tools
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz && \
tar zxf autoconf-2.69.tar.gz && \
mv autoconf-2.69 /opt/software/autoconf && \
cd /opt/software/autoconf && \
./configure && \
make && \
make install
3. Compilation
On the ARM platform, only LDB Toolchain is recommended for compilation. This method applies to Doris versions after commit 7f3564.
For how to download and install LDB Toolchain, see the section above. For the subsequent build steps, see Compile with LDB Toolchain. JDK and NodeJS must be replaced with the aarch64 versions (see the section above).
If you have trouble downloading the prebuilt third-party libraries, use tools/build_thirdparty.sh to build them yourself. Use gcc when building third-party libraries:
export DORIS_TOOLCHAIN=gcc
When compiling Doris on the ARM platform, you must disable the AVX2, LIBUNWIND, and AZURE third-party libraries:
export USE_AVX2=OFF
export USE_UNWIND=OFF
export DISABLE_BUILD_AZURE=ON
If you still encounter issues during compilation or startup, see FAQ. If no relevant solution is available, you are welcome to open an issue.
4. FAQ
4.1 Compilation Issues
1. Cannot find the directory when compiling the third-party library libhdfs3.a
-
Symptom:
The following error appears during compilation and installation:
not found lib/libhdfs3.a file or directory
-
Cause:
The third-party library dependency failed to download.
-
Solution:
Recompile third-party libraries using a third-party download repository.
export REPOSITORY_URL=https://doris-thirdparty-repo.bj.bcebos.com/thirdparty
sh /opt/doris/thirdparty/build-thirdparty.sh
REPOSITORY_URL contains the source packages of all third-party libraries and their historical versions.
2. python command not found
-
Symptom:
Running
build.shthrows the following exception:/opt/doris/env.sh: line 46: python: command not found
Python 2.7.18
-
Cause:
The system invokes Python with commands such as
python2.7,python3.6,python2, orpython3by default, but Doris dependencies require a command namedpython(2.7+ is fine). -
Solution:
Create a symbolic link at
/usr/bin/python.
# Check the python installation directory
whereis python
# Create the symbolic link
sudo ln -s /usr/bin/python2.7 /usr/bin/python
3. No output directory after compilation
-
Symptom:
After
build.shfinishes, theoutputdirectory is not found in the directory. -
Cause:
The compilation did not succeed. Recompile.
-
Solution:
sh build.sh --clean
4. spark-dpp compilation failure
-
Symptom:
During
build.sh, an error is reported when compiling spark-dpp:Failed to execute goal on project spark-dpp
-
Cause:
The Maven Central repository
repo.maven.apache.orgis unreachable and dependencies cannot be downloaded:Could not transfer artifact org.apache.spark:spark-sql_2.12:jar:2.4.6 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/apache/spark/spark-sql_2.12/2.4.6/spark-sql_2.12-2.4.6.jar: Unknown host repo.maven.apache.org
-
Solution:
Check the network and rebuild.
5. Compilation fails due to insufficient free space
-
Symptom:
During compilation, building a CXX object fails with a message that there is no free space:
fatal error: error writing to /tmp/ccKn4nPK.s: No space left on device
1112 | } // namespace doris::vectorized
compilation terminated.
-
Cause:
The device has insufficient free space.
-
Solution:
Free up space on the device, for example by deleting unneeded files.
6. pkg.m4 not found in pkg.config
-
Symptom:
A "file not found" error appears during compilation:
Couldn't find pkg.m4 from pkg-config. Install the appropriate package for your distribution or set ACLOCAL_PATH to the directory containing pkg.m4.
The logs show that this happens while compiling the
libxml2third-party library. -
Cause:
During the compilation of the
libxml2third-party library,pkg.m4cannot be located. Possible reasons:- The Ubuntu system has an issue while loading environment variables, so the index under the ldb directory is not loaded successfully.
- The environment variable lookup fails during the libxml2 build, so the build does not search the
ldb/aclocaldirectory.
-
Solution:
Copy the
pkg.m4file underldb/aclocalto thelibxml2/m4directory and rebuild the third-party libraries:
cp /opt/software/ldb_toolchain/share/aclocal/pkg.m4 /opt/doris/thirdparty/src/libxml2-v2.9.10/m4
sh /opt/doris/thirdparty/build-thirdparty.sh
7. Test CURL_HAS_TLS_PROXY fails
-
Symptom:
An error is reported during third-party package compilation:
-- Performing Test CURL_HAS_TLS_PROXY - Failed
CMake Error at cmake/dependencies.cmake:15 (get_property):
INTERFACE_LIBRARY targets may only have whitelisted properties. The property "LINK_LIBRARIES_ALL" is not allowed.
Inspecting the logs reveals that the curl header file cannot be found:
fatal error: curl/curl.h: No such file or directory
2 | #include <curl/curl.h>
compilation terminated.
ninja: build stopped: subcommand failed.
-
Cause:
The build used the system's built-in gcc 9.3.0 instead of LDB Toolchain. The LDB Toolchain environment variables need to be configured correctly.
-
Solution:
Configure the LDB environment variables:
# Configure environment variables
vim /etc/profile.d/ldb.sh
export LDB_HOME=/opt/software/ldb_toolchain
export PATH=$LDB_HOME/bin:$PATH
# Save, exit, and refresh environment variables
source /etc/profile.d/ldb.sh
# Test
gcc --version
> gcc-11
8. Compilation aborts with ninja failed with: signal: killed
-
Symptom:
BE or third-party library compilation fails midway with a message containing:
ninja failed with: signal: killed
-
Cause:
The machine is out of memory.
-
Solution:
Use a machine with more memory (at least 16 GB) for compilation, or reduce the build concurrency (
-j).
4.2 Startup Issues
1. FE fails to start, transaction -20 issue
-
Symptom:
When starting FE, a transaction error 20 is reported, with status UNKNOWN:
[BDBEnvironment.setup():198] error to open replicated environment. will exit.
com.sleepycat.je.rep.ReplicaWriteException: (JE 18.3.12) Problem closing transaction 20. The current state is:UNKNOWN. The node transitioned to this state at:Fri Apr 22 12:48:08 CST 2022
-
Cause:
Insufficient disk space.
-
Solution:
Free up disk space or mount a new disk.
2. BDB environment setup exception, disk lookup error
-
Symptom:
After migrating the disk where FE resides, starting FE throws an exception:
2022-04-22 16:21:44,092 ERROR (MASTER 172.28.7.231_9010_1650606822109(-1)|1) [BDBJEJournal.open():306] catch an exception when setup bdb environment. will exit.
com.sleepycat.je.DiskLimitException: (JE 18.3.12) Disk usage is not within je.maxDisk or je.freeDisk limits and write operations are prohibited: maxDiskLimit=0 freeDiskLimit=5,368,709,120 adjustedMaxDiskLimit=0 maxDiskOverage=0 freeDiskShortage=1,536,552,960 diskFreeSpace=3,832,156,160 availableLogSize=-1,536,552,960 totalLogSize=4,665 activeLogSize=4,665 reservedLogSize=0 protectedLogSize=0 protectedLogSizeMap=
-
Cause:
The location of FE has been migrated, and the disk information recorded in the metadata does not match. Alternatively, the disk is damaged or not mounted.
-
Solution:
- Check that the disk is healthy, initialized, and mounted correctly.
- Repair FE metadata.
- In test environments, you can delete the metadata directory and restart.
3. BE coredumps on startup, with libc.so or glibc-compatibility/ in the core stack
-
Cause:
The glibc version on the current machine is too low. Confirm with
ldd --version. This issue may occur if the version is below 2.27. -
Solution:
Recompile BE with the following environment variable added:
export GLIBC_COMPATIBILITY=OFF
4.3 Issues With Other Components
-
Symptom
If you see error messages for any of the following components, handle them with the same solution below:
- bison: error fseterr.c when installing bison-3.0.4
- flex: flex command not found
- cmake: cmake command not found / cmake cannot find dependent libraries / cmake cannot find CMAKE_ROOT / cmake cannot find the compiler set in the CXX environment variable
- boost: Boost.Build engine build failure
- mysql: cannot find the .a file of the mysql client dependency
- gcc: GCC 11+ is required
-
Cause
The correct LDB Toolchain was not used for compilation.
-
Solution
- Check whether the LDB Toolchain environment variables are configured.
- Check whether the gcc version matches what is recommended in Compile with LDB Toolchain.
- Delete the ldb directory created by running
ldb_toolchain_gen.aarch64.sh, run the script again, configure the environment variables, and verify the gcc version.