agentleFS
ROCmROCm/rocprofiler-systems-skills/skills/rocprofsys-build/SKILL.md

rocprofsys-build

Skill5 starsChanged 17 days agoMITView on GitHub

Build, test, and install rocprofiler-systems after configuration

The file

Show its rules and text

We split this skill into the rules it gives an agent

24 rules. About 0 are common, 15 are distinctive, and 9 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈15

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when:

    line 12
  2. Very specific:

    Must be in projects/rocprofiler-systems/

    line 44
  3. Very specific:

    Check for standard locations: build/debug, build/release, etc.

    line 47
  4. Very specific:

    Check for build system files (build.ninja or Makefile)

    line 52
  5. Very specific:

    If missing → invoke rocprofsys-configure first

    line 53
  6. Distinctive:

    Ask user what they want to build:

    line 62
  7. Distinctive:

    If build fails, diagnose and help user:

    line 156
  8. Distinctive:

    Read error message (usually at end of output)

    line 169
  9. Distinctive:

    Check if dependency issue or code issue

    line 171
  10. Distinctive:

    Verify compiler version (GCC 7+)

    line 177
  11. Distinctive:

    If user selected "Build and test" or explicitly wants to run tests:

    line 183
  12. Distinctive:

    Test output for failures

    line 203
  13. Distinctive:

    Test summary (X/Y passed)

    line 206
  14. Distinctive:

    If user selected "Build and install":

    line 212
  15. Very specific:

    Default: /opt/rocprofiler-systems (usually needs sudo)

    line 226
  16. Distinctive:

    Test results (if run)

    line 257
  17. Very specific:

    Test logs in build/debug/Testing/

    line 336
  18. Distinctive:

    Cause: Not in configured build directory or wrong command

    line 371
  19. Very specific:

    Run single test with verbose output: ctest -R <test-name> -V

    line 406
  20. Very specific:

    Check test log: cat build/debug/Testing/Temporary/LastTest.log

    line 407
  21. Very specific:

    Run test binary directly: ./build/debug/tests/<test-binary>

    line 408
  22. Distinctive:

    Check for missing runtime dependencies

    line 409
  23. Distinctive:

    Check test environment (GPU available, etc.)

    line 410
  24. Distinctive:

    Clean build: Use when switching branches or changing major options

    line 456

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Build ROCm Systems Profiler

Builds the rocprofiler-systems project after configuration, optionally runs tests and installs.

When to Use

Use this skill when:

  • Project is already configured (CMake cache exists)
  • User wants to compile rocprofsys
  • User wants to run tests
  • User wants to install rocprofsys
  • User asks "build rocprofsys" or "compile rocprofiler-systems"

Prerequisites

Before using this skill:

  • Project must be configured (use rocprofsys-configure first)
  • Build directory must exist with CMakeCache.txt
  • Build system (Ninja or Make) must be available

Check if configured:

# Look for CMakeCache.txt in build directory
if [ -f build/debug/CMakeCache.txt ]; then
    echo "Configured with debug preset"
elif [ -f build/release/CMakeCache.txt ]; then
    echo "Configured with release preset"
else
    echo "Not configured - run rocprofsys-configure first"
fi

Process

Phase 1: Verify Configuration

  1. Find project directory
    • Same logic as rocprofsys-configure
    • Must be in projects/rocprofiler-systems/
  2. Find build directory
    • Check for standard locations: build/debug, build/release, etc.
    • Or ask user which build directory to use
  3. Validate build is configured
    • Check for CMakeCache.txt
    • Check for build system files (build.ninja or Makefile)
    • If missing → invoke rocprofsys-configure first

Report to user:

  • Build directory found
  • Build type (Debug, Release, etc.)
  • Configuration details (enabled features)

Phase 2: Determine Build Scope

Ask user what they want to build:

Use AskUserQuestion:

header: "Build Scope"
question: "What do you want to build?"
options:
  - label: "Full build (Recommended)"
    description: "Build all targets"
  - label: "Specific target"
    description: "Build a specific library or executable"
  - label: "Build and test"
    description: "Build everything and run tests"
  - label: "Build and install"
    description: "Build, test, and install to prefix"

Phase 3: Determine Parallelism

Building rocprofsys can be memory-intensive. Determine parallel job count:

Strategy:

  1. Check available memory
  2. Suggest job count based on memory/cores
  3. Let user override
# Check system memory (GB)
TOTAL_MEM=$(free -g | awk '/^Mem:/{print $2}')

# Check CPU cores
TOTAL_CORES=$(nproc)

# Heuristic: ~4GB per parallel job for rocprofsys
SAFE_JOBS=$((TOTAL_MEM / 4))
MAX_JOBS=$((SAFE_JOBS > TOTAL_CORES ? TOTAL_CORES : SAFE_JOBS))

# Suggest to user
echo "Recommended: -j${MAX_JOBS}"

Use AskUserQuestion:

header: "Parallel Jobs"
question: "How many parallel build jobs?"
options:
  - label: "Auto (Recommended: -j8)"
    description: "Based on system memory and cores"
  - label: "Conservative (-j4)"
    description: "Safer for systems with limited memory"
  - label: "Maximum (-j$(nproc))"
    description: "Use all CPU cores (may run out of memory)"
  - label: "Custom"
    description: "Specify job count manually"

Phase 4: Build

Build command:

cmake --build <build-dir> -j <jobs> [--target <target>]

Examples:

# Full build with 8 jobs
cmake --build build/debug -j8

# Build specific target
cmake --build build/debug -j8 --target rocprof-sys-run

# Verbose output (for debugging build issues)
cmake --build build/debug -j8 --verbose

# Clean and rebuild
cmake --build build/debug -j8 --clean-first

Show build progress:

  • Ninja shows progress by default: [123/456] Building CXX object...
  • Make needs -j for parallel build

Monitor for issues:

  • Compiler errors
  • Linker errors
  • Out of memory errors
  • Missing dependencies

Phase 5: Handle Build Errors (if any)

If build fails, diagnose and help user:

Common build errors:

Error TypeSymptomsSolution
Out of memoryc++: fatal error: KilledReduce parallel jobs: -j2 or -j4
Missing headersfatal error: xyz.h: No such fileMissing dependency, reconfigure with BUILD_<DEP>=ON
Linker errorsundefined reference toDependency issue, rebuild dependencies
Template errorsLong C++ template errorsUsually code issue, read error carefully
External dependency failureError in external/dyninst/Clean build, try again, or use system package

Steps to diagnose:

  1. Read error message (usually at end of output)
  2. Identify which source file/target failed
  3. Check if dependency issue or code issue
  4. Suggest fix based on error type

If build fails repeatedly:

  • Try clean rebuild: remove build directory, reconfigure
  • Check system dependencies
  • Verify compiler version (GCC 7+)
  • Check disk space
  • Reduce parallelism

Phase 6: Run Tests (Optional)

If user selected "Build and test" or explicitly wants to run tests:

# Run all tests
cd <build-dir>
ctest --output-on-failure

# Run tests in parallel
ctest -j8 --output-on-failure

# Run specific test
ctest -R <test-name> --output-on-failure

# Verbose test output
ctest -V

Monitor test results:

  • How many passed/failed
  • Which tests failed
  • Test output for failures

Report to user:

  • Test summary (X/Y passed)
  • Failed tests with output
  • Next steps if tests fail

Phase 7: Install (Optional)

If user selected "Build and install":

# Install to prefix (may need sudo)
cmake --install <build-dir>

# Install to custom prefix
cmake --install <build-dir> --prefix /custom/path

# Install specific component
cmake --install <build-dir> --component <component>

Check install prefix:

  • Default: /opt/rocprofiler-systems (usually needs sudo)
  • Can be changed during configure: -DCMAKE_INSTALL_PREFIX=...

Verify installation:

# Check installed binaries
ls <install-prefix>/bin/rocprof-sys-*

# Check installed libraries
ls <install-prefix>/lib/librocprof-sys*

# Check setup script
cat <install-prefix>/share/rocprofiler-systems/setup-env.sh

Setup environment:

# Option 1: Source setup script
source /opt/rocprofiler-systems/share/rocprofiler-systems/setup-env.sh

# Option 2: Manual
export PATH=/opt/rocprofiler-systems/bin:$PATH
export LD_LIBRARY_PATH=/opt/rocprofiler-systems/lib:$LD_LIBRARY_PATH

Phase 8: Report Results

On success:

  • Build completed successfully
  • Build time
  • Number of targets built
  • Test results (if run)
  • Install location (if installed)
  • Next steps (how to use rocprofsys)

On failure:

  • What failed (build/test/install)
  • Error summary
  • Suggested fixes
  • Whether to retry

Build Examples

Example 1: Quick Build

cd /path/to/projects/rocprofiler-systems
cmake --build build/debug -j8

Example 2: Build with Tests

cd /path/to/projects/rocprofiler-systems
cmake --build build/debug -j8
cd build/debug
ctest --output-on-failure

Example 3: Build and Install

cd /path/to/projects/rocprofiler-systems
cmake --build build/release -j8
sudo cmake --install build/release

Example 4: Incremental Build (after code changes)

cd /path/to/projects/rocprofiler-systems
cmake --build build/debug -j8
# Only rebuilds changed files

Example 5: Clean Rebuild

cd /path/to/projects/rocprofiler-systems
cmake --build build/debug -j8 --clean-first

Example 6: Build Specific Target

cd /path/to/projects/rocprofiler-systems
cmake --build build/debug -j8 --target rocprof-sys-run

Output

This skill produces:

Build artifacts:

projects/rocprofiler-systems/
└── build/
    └── debug/                          # Or release, etc.
        ├── source/
        │   ├── bin/
        │   │   └── rocprof-sys-run/
        │   │       └── rocprof-sys-run    # Executable
        │   └── lib/
        │       └── rocprof-sys/
        │           └── librocprof-sys.so  # Library
        └── ...

Test results:

  • CTest output
  • Test logs in build/debug/Testing/

Installation (if installed):

/opt/rocprofiler-systems/
├── bin/
│   ├── rocprof-sys-run
│   ├── rocprof-sys-instrument
│   └── ...
├── lib/
│   ├── librocprof-sys.so
│   └── ...
├── include/
│   └── rocprofiler-systems/
└── share/
    └── rocprofiler-systems/
        └── setup-env.sh

Common Mistakes

MistakeFix
Building without configuringRun rocprofsys-configure first
Too many parallel jobsReduce to -j4 or -j2 if out of memory
Building in wrong directoryMust be in project root, build dir is specified with -B or --build
Not running testsAlways run tests after build, especially for changes
Installing without sudoUse sudo cmake --install if prefix is /opt
Not checking test resultsReview failed tests before proceeding
Ignoring build warningsSome warnings indicate real issues

Troubleshooting

Issue: "make: *** No targets specified"

Cause: Not in configured build directory or wrong command

Solution:

# Use cmake --build, not make directly
cmake --build build/debug

Issue: "c++: fatal error: Killed signal terminated program"

Cause: Out of memory

Solution:

# Reduce parallel jobs
cmake --build build/debug -j2

# Or add swap space

Issue: "ninja: error: loading 'build.ninja': No such file"

Cause: Build directory not configured

Solution:

# Run configure first
cmake --preset debug
# Then build
cmake --build build/debug

Issue: Tests failing

Steps:

  1. Run single test with verbose output: ctest -R <test-name> -V
  2. Check test log: cat build/debug/Testing/Temporary/LastTest.log
  3. Run test binary directly: ./build/debug/tests/<test-binary>
  4. Check for missing runtime dependencies
  5. Check test environment (GPU available, etc.)

Issue: Install fails with permission denied

Solution:

# Use sudo for system paths
sudo cmake --install build/release

# Or configure with user prefix
cmake -B build/release -DCMAKE_INSTALL_PREFIX=$HOME/rocprofsys
cmake --install build/release  # No sudo needed

Integration with Other Skills

After BuildUse
Build successfulTest the installation, run examples
Build failedReview errors, reconfigure if needed
Tests failedDebug failed tests, fix code
Ready to commitgit-commit to commit changes
Ready for PRgit-prepare-pull-request

Build Targets Reference

Common targets:

  • all (default) - Build everything
  • rocprof-sys-run - Main profiler executable
  • rocprof-sys-instrument - Binary instrumentation tool
  • rocprof-sys-avail - Available metrics tool
  • tests - Build all tests (without running)

To see all targets:

cmake --build build/debug --target help

Notes

  • Incremental builds: CMake tracks dependencies, only rebuilds changed files
  • Build cache: Object files cached in build directory for fast rebuilds
  • Parallel builds: Ninja is faster than Make for parallel builds
  • Memory usage: Building with all cores can use 20-30GB RAM
  • Build time: Full build: 10-30 minutes (depends on parallelism, dependencies)
  • Incremental build: Usually < 1 minute for small changes
  • Clean build: Use when switching branches or changing major options

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.