Compiling Code
Compile all source code to obtain the doris_be binary file. Use the obtained doris_be to replace all the doris_be files in the cluster BEs to gain better performance.
- Go to the /opt/tools/installed/ directory. Download and decompress the Doris-2.1.2-rc04 source package.
1 2 3 4
cd /opt/tools/installed wget https://github.com/apache/doris/archive/refs/tags/2.1.2-rc04.zip mv 2.1.2-rc04.zip ./doris-2.1.2-rc04.zip unzip doris-2.1.2-rc04.zip
- Download and decompress the pre-compiled third-party library doris-thirdparty-prebuild-arm64.tar.xz and move it to the Doris file directory /thirdparty.
1 2 3 4 5
cd /opt/tools/installed wget https://github.com/apache/doris-thirdparty/releases/download/automation/doris-thirdparty-prebuild-arm64.tar.xz tar -xvf doris-thirdparty-prebuild-arm64.tar.xz cp installed/lib64/libjemalloc_doris_pic.a installed/lib64/libjemalloc_arrow.a mv installed /opt/tools/installed/doris-2.1.2-rc04/thirdparty/
- Download and decompress the third-party source package doris-thirdparty-source.tgz, move it to the Doris file directory /thirdparty, and decompress bitshuffle-0.5.1.tar.gz.
1 2 3 4 5 6
cd /opt/tools/installed wget https://github.com/apache/doris-thirdparty/releases/download/automation/doris-thirdparty-source.tgz tar -xzf doris-thirdparty-source.tgz mv src /opt/tools/installed/doris-2.1.2-rc04/thirdparty/ cd /opt/tools/installed/doris-2.1.2-rc04/thirdparty/src tar -xvf bitshuffle-0.5.1.tar.gz
- Download the Bitshuffle source code and patch, decompress the patch to the source code path, obtain the modified bitshuffle_core.c, and replace thirdparty/src/bitshuffle-0.5.1/src/bitshuffle_core.c with the modified bitshuffle_core.c.
- Go to the /opt/tools/installed directory. Download and decompress the Bitshuffle source package.
1 2 3
cd /opt/tools/installed wget https://github.com/kiyo-masui/bitshuffle/archive/0.5.1.tar.gz tar -xvf 0.5.1.tar.gz
- Download the Bitshuffle patch and move it to the project path of the Bitshuffle source code.
1 2 3
cd /opt/tools/installed/ wget https://gitee.com/kunpengcompute/boostkit-bigdata/releases/download/24.0.RC5-doris_neon_optimization/bitshuffle.patch mv bitshuffle.patch /opt/tools/installed/bitshuffle-0.5.1/
- Apply the optimized bitshuffle.patch.
1 2
cd /opt/tools/installed/bitshuffle-0.5.1/ patch -p1 < bitshuffle.patch
- Replace thirdparty/src/bitshuffle-0.5.1/src/bitshuffle_core.c with the modified bitshuffle_core.c.
1cp /opt/tools/installed/bitshuffle-0.5.1/src/bitshuffle_core.c /opt/tools/installed/doris-2.1.2-rc04/thirdparty/src/bitshuffle-0.5.1/src/bitshuffle_core.c
- Go to the /opt/tools/installed directory. Download and decompress the Bitshuffle source package.
- Modify thirdparty/build-thirdparty.sh to make it compile Bitshuffle only.
- Open the file.
1vi /opt/tools/installed/doris-2.1.2-rc04/thirdparty/build-thirdparty.sh - Press i to enter the insert mode. Comment out lines 1796 to 1869, and add line 1871 to set packages to bitshuffle.
1packages=(bitshuffle)


- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the file.
- Use GCC 12 to compile the third-party Bitshuffle.
1 2 3
export DORIS_TOOLCHAIN=gcc cd /opt/tools/installed/doris-2.1.2-rc04/thirdparty sh build-thirdparty.sh
- Use Clang 17 to compile a BE.
- Download the development package of the binutils tool.
1yum install binutils-devel.aarch64
- Add environment variables.
1export DORIS_TOOLCHAIN=clang
- Open the build.sh file.
1 2
cd /opt/tools/installed/doris-2.1.2-rc04 vi build.sh
- Press i to enter insert mode. Then, specify the submodule versions on lines 505 and 506 to ensure that the submodules are compatible with the Doris main code.
update_submodule "be/src/apache-orc" "apache-orc" "https://github.com/apache/doris-thirdparty/archive/d7975612de8b9711a284af9d7cba5248c49f73b3.tar.gz" update_submodule "be/src/clucene" "clucene" "https://github.com/apache/doris-thirdparty/archive/ef95e67ae3123409f006072194f742a079603159.tar.gz"

- Add compilation option --gcc-install-dir=/opt/tools/installed/gcc-12.3.1-2024.05-aarch64-linux/lib64/gcc/aarch64-linux-gnu/12.3.1 to line 550.
1-DEXTRA_CXX_FLAGS="${EXTRA_CXX_FLAGS} --gcc-install-dir=/opt/tools/installed/gcc-12.3.1-2024.05-aarch64-linux/lib64/gcc/aarch64-linux-gnu/12.3.1"
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Compile a BE.
1STRIP_DEBUG_INFO=ON sh build.sh --clean --be
- Download the development package of the binutils tool.
- Obtain doris_be compiled by Clang 17.
After BE compilation is complete, the binary file doris_be is obtained.
1cd /opt/tools/installed/doris-2.1.2-rc04/be/output/lib
Parent topic: Software Compilation