Compile and Run Doris on ARM64 + KylinOS.
Note that this document is only a guide document. Other errors may occur when compiling in different environments.
KylinOS version:
CPU model
model name: Phytium,FT-2000+/64
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.
Download gcc-10.1.0
wget https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-10.1.0/gcc-10.1.0.tar.gz
After unzipping, check the dependencies in contrib/download_prerequisites
and download:
http://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2
http://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2
http://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz
http://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2
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)
Compile GCC10:
cd gcc-10.1.0
./configure --prefix=/home/doris/tools/installed
Compile time is longer.
jdk-8u291-linux-aarch64.tar.gz
https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
No need to compile, just use it out of the box.
cmake-3.19.8-Linux-aarch64.tar.gz
No need to compile, just use it out of the box
apache-maven-3.8.1-bin.tar.gz
https://maven.apache.org/download.cgi
No need to compile, just use it out of the box
nodejs 16.3.0
https://nodejs.org/dist/v16.3.0/node-v16.3.0-linux-arm64.tar.xz
No need to compile, just use it out of the box
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.
https://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.gz
cd libtool-2.4.6/
./configure --prefix=/home/doris/tools/installed
make -j && make install
binutils-2.36.tar.xz (obtain bdf.h)
https://ftp.gnu.org/gnu/binutils/binutils-2.36.tar.bz2
./configure --prefix=/home/doris/tools/installed
Libiberty (for compiling BE)
The source code of this library is under the source code package of gcc-10.1.0
After compilation, libiberty.a will be generated, which can be moved to the lib64 directory of Doris’ thirdparty.
Suppose Doris source code is under /home/doris/doris-src/
.
Manually download all third-party libraries and place them in the thirdparty/src directory.
Add
custom_env.sh
in the Doris source directory and add the following contentexport 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/
Pay attention to replace the corresponding directory
-
Close
build_mysql
andbuild_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.
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'
Execute build-thirdparty.sh. 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
inCMAKE_CXX_FLAGS
of CMakeLists.txt of brpc. This problem has been fixed in the brpc master code:https://github.com/apache/incubator-brpc/issues/1091
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
build-thirdparty.sh
, find thebuild_zlib
function, and change:./configure --prefix=$TP_INSTALL_DIR --static
Just change to
./configure --prefix=$TP_INSTALL_DIR
Find and comment out the following parts:
#if [-f $TP_INSTALL_DIR/lib64/libcrypto.so ]; then
# rm -rf $TP_INSTALL_DIR/lib64/libcrypto.so*
#fi
#if [-f $TP_INSTALL_DIR/lib64/libssl.so ]; then
# rm -rf $TP_INSTALL_DIR/lib64/libssl.so*
#fi
Then go to
build-thirdparty.sh
, comment out otherbuild_xxx
, open onlybuild_zlib
andbuild_openssl
, andbuild_brpc
and laterbuild_xxx
. Then re-executebuild-thirdparty.sh
.The compilation is stuck at a certain stage.
Not sure why. Solution: Rerun
build-thirdparty.sh
.build-thirdparty.sh
can be executed repeatedly.
Execute sh build.sh
.
undefined reference to psl_free
appears when compiling Dorislibcurl will call libpsl functions, but libpsl is not linked for an unknown reason. Solutions (choose one of the two):
- Add
--without-libpsl
to thebuild_curl
method inthirdparty/build-thirdparty.sh
, recompile libcurl, and then recompile Doris. - About line 603 in
be/CMakeLists.txt
, add after-pthread
, and then recompile Doris.
- Add