com um clique
compile
// Building LoongCollector C++ and Go components. Use when compiling any part of the project.
// Building LoongCollector C++ and Go components. Use when compiling any part of the project.
在进行 Code Review 时,使用这个技能对 LoongCollector 变更进行安全导向、架构一致性优先的深度代码评审。
Write commit messages following to Conventional Commits standards.
Design document writing conventions. Use when writing or reviewing technical design documents.
LoongCollector E2E 测试全流程指南:设计、编写、运行和调试。当需要编写新 E2E 测试、运行现有测试、或排查 E2E 测试失败时使用此 skill。
Mermaid diagram conventions. Use whenever diagrams are needed in documentation or code review.
LoongCollector project knowledge: architecture, terminology, codebase map, and coding standards (C++/Go).
| name | compile |
| description | Building LoongCollector C++ and Go components. Use when compiling any part of the project. |
This project has both C++ and Go components. Use the appropriate build method based on what you modified.
IMPORTANT: All CMake and make commands must run from inside the build/ directory. Running from repo root will reconfigure incorrectly.
Prerequisites — Git submodules must be populated before first build:
git submodule update --init --recursive
Two submodules live under core/_thirdparty/:
DCGM — NVIDIA DCGM headers (dcgm_agent.h etc.)coolbpf — eBPF frameworkIf either is empty, compilation fails with No such file or directory.
mkdir -p build && cd build
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=OFF ../core
make -sj$(nproc)
Key CMake flags:
| Flag | Purpose |
|---|---|
BUILD_LOGTAIL | Build LoongCollector binary. Required. |
BUILD_LOGTAIL_UT | Build unit tests. Enable when modifying tests. |
WITHSPL | SPL support. Set OFF unless working on SPL files. |
Each test directory under core/unittest/*/ produces its own executable.
Build tests (from inside build/):
make yaml_util_unittest app_config_unittest safe_queue_unittest -j$(nproc)
Run tests (from inside build/):
./unittest/common/yaml_util_unittest
./unittest/app_config/app_config_unittest
Tests must run from build/ because some rely on relative paths for config files and temporary output.
make plugin_local
make image
For ARM64:
make image ARCH=arm64
apt or yummake clean then rebuildWITHSPL=OFF to WITHSPL=ON in the cmake command