SuperAPI AI Directory

compile

Coding & development

View repository

Updated 10-15 16:47

About this skill

How to compile this project

This project is divided into a C++ part and a Go part. When you modify code in different types of files, please use different compilation methods.

C++ part compilation method

  1. Determine whether to perform an incremental build. If there is already a build directory, and it contains content, and your changes do not involve CMake-related files, then skip to step 5 to perform an incremental build.

  2. Create the build directory

mkdir -p build
  1. Enter the build directory
cd build
  1. Construct the CMake command
cmake -DCMAKE_BUILD_TYPE=Debug -DLOGTAIL_VERSION=0.0.1 \
      -DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
      -DCMAKE_CXX_FLAGS="-I/opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include -I/opt/logtail -I/opt/logtail_spl" \
      -DBUILD_LOGTAIL=ON -DBUILD_LOGTAIL_UT=ON -DWITHOUTGDB=ON -DENABLE_STATIC_LINK_CRT=ON -DWITHSPL=ON ../core

Note the several switches among them: - BUILD_LOGTAIL: indicates compiling the LoongCollector binary. Required. - BUILD_LOGTAIL_UT: indicates compiling the LoongCollector unit tests. Enable only when you have modified the LoongCollector unit tests. - WITHSPL: indicates compiling LoongCollector SPL-related content. Enable only when you have modified LoongCollector SPL-related files.

  1. Compile
make -sj$(nproc)

Go part compilation method

Execute

make plugin_local