Get the FREE Ultimate OpenClaw Setup Guide →

compile-error-analysis

Scanned
npx machina-cli add skill Jiusi-pys/agent-plugins/compile-error-analysis --openclaw
Files (1)
SKILL.md
1.5 KB

Compile Error Analysis Skill

概述

提供 OHOS 交叉编译错误的诊断和修复能力。

错误分类

1. 头文件错误

2. 符号未定义

3. 类型不兼容

4. 链接错误

快速诊断

# 运行错误分析脚本
./scripts/analyze_errors.sh build.log

常见错误速查

错误原因修复
sys/epoll.h not foundLinux 特有使用 poll.h
undefined reference to 'epoll_create'Linux 特有条件编译
cannot find -lrtOHOS 在 libc 中移除 -lrt
incompatible pointer typeABI 差异检查类型定义

OHOS 工具链检查

# 检查 clang
${OHOS_SDK}/native/llvm/bin/clang --version

# 检查 sysroot
ls -la ${OHOS_SDK}/native/sysroot/usr/include/

# 检查库路径
ls -la ${OHOS_SDK}/native/sysroot/usr/lib/aarch64-linux-ohos/

Source

git clone https://github.com/Jiusi-pys/agent-plugins/blob/main/plugins/ohos-porting/skills/compile-error-analysis/SKILL.mdView on GitHub

Overview

This skill diagnoses OHOS cross-compilation failures and suggests fixes. It classifies errors into header errors, undefined symbols, type incompatibility, and linker errors, helping pinpoint root causes and guiding remediation. It also supports auto-loading guidance when a compile error occurs.

How This Skill Works

It analyzes the build log, maps symptoms to predefined error classes, and outputs targeted fixes and workarounds. It references common causes and recommended references, and can automatically load relevant guidance when a compile failure happens.

When to Use It

  • When a cross-compile fails with a header not found error
  • When undefined reference errors appear during linking
  • When there is a type incompatibility due to ABI differences
  • When encountering linker errors like cannot find -lxxx
  • When you need to verify OHOS toolchain setup including clang version, sysroot, and library paths

Quick Start

  1. Step 1: Run the analysis script with your build log: ./scripts/analyze_errors.sh build.log
  2. Step 2: Review the recommended fix for the identified error category
  3. Step 3: Rebuild the project and verify the fix; re-run if needed

Best Practices

  • Classify errors into header, symbol, type, and linker categories first
  • Run the error analysis script with the build log
  • Check OHOS toolchain clues: clang version, sysroot contents, library paths
  • Use conditional compilation to isolate OS or ABI differences
  • Consult the provided reference files for deeper debugging

Example Use Cases

  • fatal error: xxx.h: No such file or directory
  • undefined reference to 'xxx'
  • error: incompatible types
  • cannot find -lrt
  • sys/epoll.h not found

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers