Compilation

    1. Download Docker image

      Check if the download is completed

    Note:

    1. Run the image

      $ docker run -it apache/doris:build-env-ldb-toolchain-latest

      It is recommended to run the image by mounting the local Doris source directory, so that the compiled binary file will be stored in the host machine and will not disappear because of the exit of the image.

      Meanwhile, it is recommended to mount the maven .m2 directory in the image to the host directory to prevent repeated downloading of maven’s dependent libraries each time the compilation is started.

      1. $ docker run -it -v /your/local/.m2:/root/.m2 -v /your/local/doris-DORIS-x.x.x-release/:/root/doris-DORIS-x.x.x-release/ apache/doris:build-env-ldb-toolchain-latest
    2. Download source code

      After starting the image, you should be in the container. You can download the Doris source code using the following command (If you have mounted the local Doris source directory, you don’t need do this):

    3. Compile Doris

      If it is not supported, use the following command to compile.

      1. $ USE_AVX2=0 sh build.sh

      If supported, use the following command to compile.

      1. $ sh build.sh

      After compilation, the output files will be in the output/ directory.

      After compilation, the output file will be in the output/ directory.

    Self-Compile Development Environment Image

    You can create a Doris development environment image yourself. Check for details.

    You can compile Doris directly in your own Linux environment.

    1. System Dependencies

      • System dependencies before commit are as follows:

        GCC 7.3+, Oracle JDK 1.8+, Python 2.7+, Apache Maven 3.5+, CMake 3.11+ Bison 3.0+

        If you are using Ubuntu 16.04 or newer, you can use the following command to install the dependencies:

        1. sudo apt-get install build-essential openjdk-8-jdk maven byacc flex automake libtool-bin bison binutils-dev libiberty-dev zip unzip libncurses5-dev curl git ninja-build python autopoint pkg-config
        2. apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main'
        3. apt-get update && apt-get install cmake

        If you are using CentOS, you can use the following command to install the dependencies:

        sudo yum groupinstall 'Development Tools' && sudo yum install maven cmake byacc flex automake libtool bison binutils-devel zip unzip ncurses-devel curl git wget python2 glibc-static libstdc++-static java-1.8.0-openjdk

      • System dependencies after commit ad67dd3 are as follows:

        GCC 10+, Oracle JDK 1.8+, Python 2.7+, Apache Maven 3.5+, CMake 3.19.2+ Bison 3.0+

        If you are using Ubuntu 16.04 or newer, you can use the following command to install the dependencies:

        1. sudo apt install build-essential openjdk-8-jdk maven cmake byacc flex automake libtool-bin bison binutils-dev libiberty-dev zip unzip libncurses5-dev curl git ninja-build python
        2. sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
        3. ln -s /usr/bin/g++-11 /usr/bin/g++
        4. ln -s /usr/bin/gcc-11 /usr/bin/gcc
        5. sudo apt-get install autoconf automake libtool autopoint
    2. This is the same as compiling with the Docker development image. Before compiling, you need to check whether the avx2 instruction is supported.

      If it is supported, use the following command to compile:

      1. $ sh build.sh

      If not supported, use the following command to compile:

      1. $ USE_AVX2=0 sh build.sh

      After compilation, the output files will be in the output/ directory.

    1. Could not transfer artifact net.sourceforge.czt.dev:cup-maven-plugin:pom:1.6-cdh from/to xxx

      If you encounter the above error, please refer to PR #4769 and modify the cloudera-related repo configuration in fe/pom.xml.

    2. Invalid download links of third-party dependencies

      The download links of the third-party libraries that Doris relies on are all in the thirdparty/vars.sh file. Over time, some download links may fail. If you encounter this situation. It can be solved in the following two ways:

      1. Manually modify the thirdparty/vars.sh file

        Manually modify the problematic download links and the corresponding MD5 value.

      2. Use a third-party download warehouse:

        1. export REPOSITORY_URL=https://doris-thirdparty-repo.bj.bcebos.com/thirdparty
        2. sh build-thirdparty.sh

        REPOSITORY_URL contains all third-party library source code packages and their historical versions.

    3. fatal error: Killed signal terminated program ...

      If you encounter this error, the possible reason is not enough memory allocated to the image. (The default memory allocation for Docker is 2 GB, and the peak memory usage during the compilation might exceed that.)

      You can fix this by increasing the memory allocation for the image, 4 GB ~ 8 GB, for example.

    Starting from version 0.13, the dependency on the two third-party libraries [1] and [2] will be removed in the default compiled output. These two third-party libraries are under GNU General Public License V3. This license is incompatible with , so it will not appear in the Apache release by default.

    Remove library [1] will result in the inability to access MySQL external tables. The feature of accessing MySQL external tables will be implemented through UnixODBC in future release version.

    Remove library [2] will cause some data written in earlier versions (before version 0.8) to be unable to read. Because the data in the earlier version was compressed using the LZO algorithm, in later versions, it has been changed to the LZ4 compression algorithm. We will provide tools to detect and convert this part of the data in the future.

    If required, you can continue to use these two libraries by adding the following option when compiling:

    • [1] mysql-5.7.18
    • [2] lzo-2.10