-
Notifications
You must be signed in to change notification settings - Fork 0
Troubleshooting
CMake Error: Could not find a package configuration file provided by "LLVM"
Set the paths manually:
LLVM_DIR=/usr/lib/llvm-20/lib/cmake/llvm \
Clang_DIR=/usr/lib/llvm-20/lib/cmake/clang \
./build.shOn macOS with Homebrew:
LLVM_DIR=$(brew --prefix llvm)/lib/cmake/llvm \
Clang_DIR=$(brew --prefix llvm)/lib/cmake/clang \
./build.shThe analyzer requires LLVM 19+. Check your version:
llvm-config --versionThe default configuration uses LLVM_LINK_LLVM_DYLIB=ON (dynamic linking). If your LLVM installation doesn't provide libLLVM.so/libLLVM.dylib, try:
cmake -S . -B build -DLLVM_LINK_LLVM_DYLIB=OFF ...- Check that include paths are correct (
-I) - Verify the compile database entries point to existing files
- Use
--timingto see if compilation fails silently - Try
--dump-ir=debug/to inspect the generated IR
A compile_commands.json generated on macOS often fails in Linux CI:
fatal error: 'TargetConditionals.h' file not found
Solutions:
- Generate the compile database on the same platform as the analyzer
- Use
--compdb-fastto strip platform-specific flags - Extend the Docker image with needed headers
- Switch to
--analysis-profile=fast - Use
--jobs=<N>for parallel processing - Use
--exclude-dirto skip third-party code - Use
--compdb-fastto speed up compilation from compile databases - Use
--resource-summary-cache-memory-onlyto avoid filesystem I/O
- Use
--warnings-onlyto focus on important findings - Use
--escape-modelto suppress false stack escape warnings - Use
--only-diror--only-fileto focus on your code - Exclude third-party code with
--exclude-dir=_deps,vendor,third_party
- Check that your
--resource-modelhas correct acquire/release pairings - Verify arg indices match the actual function signatures
- Use
ResourceLifetime.IncompleteInterprocwarnings to identify missing model entries - Enable cross-TU summaries for better precision with multi-file projects
If the compile database was generated in a different checkout root (e.g., /tmp/ci-build/...) while the repo is mounted at /workspace, the Docker entrypoint automatically creates a compatibility symlink when safe.
Run with matching user/group:
docker run --rm \
-u "$(id -u):$(id -g)" \
-v "$PWD:/workspace" \
coretrace-stack-analyzerThe CI adapter looks for the binary at build/stack_usage_analyzer by default. Override with:
python3 scripts/ci/run_code_analysis.py --analyzer /path/to/stack_usage_analyzer ...Check that:
-
compile_commands.jsonexists and is valid JSON - Source files referenced in the database actually exist
-
--excludepatterns are not too broad - Enable
--inputs-from-gitas a fallback
Ensure the workflow has the correct permissions:
permissions:
contents: read
security-events: write./build/stack_usage_analyzer main.cpp --dump-ir=debug/main.llInspect the IR to understand what the analyzer sees.
./build/stack_usage_analyzer --compdb=build --only-dir=src/ --dump-filter 2>filter.log./build/stack_usage_analyzer --compdb=build --timing 2>timing.logShows per-file compilation and analysis times, plus cross-TU summary iteration times.
The analyzer uses coretrace-logger. Debug-level logging is available but not exposed via CLI flags by default. Look for status lines on stderr for inter-procedural analysis status.