Manual compilation of StarRocks-2.0 in ARM environment

Posted by dpsd on Sun, 20 Feb 2022 09:19:05 +0100

1. Background

Since the official version of rockdoc is available in the cloud environment, rockdoc has to be used as the real-time image of the company's own version, but it is not installed in the cloud environment. According to the release of StarRocks official website, ARM environment is supported in version 2.0, so it starts to scratch the head to compile

2. Main references

Due to the lack of relevant materials, I went to the Apache Doris official website to find the compilation process of the ARM platform as the main reference. Here emmmm, I won't say much
Compiled by Apache Doris ARM

3. Environment

3.1. Kernel version3.2.StarRocks version
commit 6ff9eab75bea921809868b1cae8bcb2d2f638bfc

4. Compilation

4.1. Compiler installation

4.1.1. Install gcc-10.1.0

Download gcc-10.1.0


After decompression, download the dependency:

Unzip the four dependencies, then move them to the gcc-10.1.0 source directory and rename them gmp, isl, mpc and mpfr.
Download and install automake-1.15 (because gcc10 will look for automake version 1.15 during compilation)
tar xzf automake-1.15.tar.gz
./configure --prefix=/home/starrocks/tools/installed
make && make install
export PATH=/home/doris/tools/installed/bin:$PATH

Compiling GCC10:

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

4.1.2. Install other compilation components

  1. jdk-8u291-linux-aarch64.tar.gz
  1. cmake-3.19.8-Linux-aarch64.tar.gz
  1. apache-maven-3.8.1-bin.tar.gz
  1. nodejs 16.3.0

Note: the above components do not need to be compiled and can be used after decompression, but remember to configure environment variables!

  1. libtool-2.4.6.tar.gz
cd  libtool-2.4.6/
./configure --prefix=/home/starrocks/tools/installed
make -j && make install
  1. binutils-2.36.tar.xz (get bdf.h)
./configure --prefix=/home/starrocks/tools/installed
make -j && make install

Note: if only binuntils is installed here, the following errors may appear when compiling be later:
so, you need to install binutils devel here, just follow the rpm package

  1. binutils-devel-2.27-44.base.el7.aarch64.rpm
rpm -ivh binutils-devel-2.27-44.base.el7.aarch64.rpm
  1. 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/starrocks/tools/installed

Libiberty will be generated after compilation a. Then move it to the lib64 directory of thirdparty in the StarRocks decompression directory (without creating a new one).

4.2. Compile the third Library of StarRocks

Unzip the source directory to / home / starrocks / starrocks Src /

cd /home/starrocks/starrocks-src/thirdparty
  1. Run the script when there is a network and download the third library

If you are not connected to the Internet, you can also run the script (only print without downloading if you modify it slightly), list the address of the third-party library to be downloaded, download it manually, and create a new thirdparty/src directory into it.

  1. Add custom in the starrocks source directory_ env. SH and add the following
export DORIS_THIRDPARTY=/home/starrocks/starrocks-src/thirdparty
export JAVA_HOME=/home/starrocks/tools/jdk1.8.0_291/
export DORIS_GCC_HOME=/home/starrocks/tools/installed/
  1. Modify build thirdparty Part of SH
    In build_ Add the configure parameter in curl: – without libpsl. If it is not added, an error may be reported in the link phase of the final compilation of Doris BE: undefined reference to 'psl_is_cookie_domain_acceptable’

  2. Execute build thirdparty sh.
    Here comes the point. The most possible error is reported here!!!

    libcrypto.a(sha1-armv8.0):relocation R_AARCH64_ADR_PREL_PG_HI21 against symbolz_errmsg' which may bind externally can not be used when making a shared object; recompile with -fPIC
    In fact, the error reporting here has been very obvious, but I didn't understand it at the beginning. I was stuck here for a long time. shaxxx-armv8.0 of openssl 0 this source file has some small problems and needs to be modified.
    Solution: switch to the source directory of openssl-1.0.2k and modify the file corresponding to the error:
    Reference link:
    This link is the solution of openssl-1.1.1. For openssl-1.0.2k, you only need to modify the corresponding file with error, mainly the following two files:

    .extern OPENSSL_armcap_P .hidden OPENSSL_armcap_P these two items are not in the two files, and need to be added!!! Then delete the to be deleted! After modifying the source code, an error is reported, and run build thirdparty again sh

  3. What if an error is reported at a certain stage of compilation
    There is no need to compile from scratch. Comment out all errors before compiling. Solve the problem of debugging the error reporting third-party library. There is no need to spend time compiling other third-party libraries that are OK.

4.3. Compile StarRocks source code

After all the third-party libraries can be compiled, start compiling the source code
Execute sh build. In the StarRocks source directory SH is enough!
After compilation, it will be output to the output directory of the source directory. After packaging, it can be put into the corresponding ARM environment, and the machine can be installed!!!

5. Summary

In the final analysis, it's still their own dishes. If there is a problem with compilation, it will have to be solved for a long time
However, it took a few days to compile. Since the official did not give the compilation process of ARM environment, he sorted out and sent out his meal operation, hoping to help those in need!
<( ̄▽ ̄)/

Topics: Linux Database ARM