Skip to content

Expand building Claude skill to cover general ET building from source#2

Draft
psiddh wants to merge 24 commits intomainfrom
expand-building-claude-skill
Draft

Expand building Claude skill to cover general ET building from source#2
psiddh wants to merge 24 commits intomainfrom
expand-building-claude-skill

Conversation

@psiddh
Copy link
Owner

@psiddh psiddh commented Mar 9, 2026

Summary

The existing /building Claude skill only covered runners (Makefile targets like make llama-cpu) and a couple of CMake workflow presets. This PR expands it into a comprehensive guide for building ExecuTorch from source.

Changes

Expanded .claude/skills/building/SKILL.md from 23 lines to 353 lines, covering:

New Sections

  1. Prerequisites — toolchain requirements (Python, CMake, C++17 compiler, submodules, ccache, Ninja)
  2. Building the Python Packageinstall_executorch.sh with all flags, backend enablement via CMAKE_ARGS, verification
  3. Building the C++ Runtime — presets table (16 presets), workflow presets, manual CMake, verification
  4. Building Runners — expanded Makefile targets (all current models)
  5. Cross-Compilation — Android (AAR + native), iOS/macOS frameworks, Windows (Clang-CL)
  6. Key Build Options — complete reference table of 27 CMake options with types, defaults, descriptions, and dependency chains
  7. Common Build Patterns — minimal, XNNPACK, profiling, tests, CMake subdirectory usage
  8. Troubleshooting — 12 common build issues with symptoms and fixes
  9. Build Output — reference table of artifacts and their locations
  10. Tips — practical advice for faster and more reliable builds

Motivation

The original skill was too narrow for Claude to help users build ExecuTorch from source. Users asking Claude to 'build ExecuTorch' would only get runner-specific instructions, missing the broader Python package install, standalone C++ runtime build, cross-compilation, and troubleshooting guidance.

Testing

This is a documentation-only change to a Claude skill file. No code changes.

Target: pytorch/executorch (to be submitted as upstream PR)

cc @Mengwei-Liu

psiddh and others added 24 commits March 9, 2026 16:41
The existing building skill only covered runners (Makefile targets) and
CMake workflow presets. This expands it to be a comprehensive guide for
building ExecuTorch from source, including:

- Prerequisites and toolchain requirements
- Building the Python package (install_executorch.sh with all flags)
- Building the C++ runtime standalone (presets, workflows, manual CMake)
- Building model runners (Makefile)
- Cross-compilation (Android, iOS, macOS, Windows)
- Complete build options reference with dependency chains
- Common build patterns (minimal, XNNPACK, profiling, tests, subdirectory)
- Troubleshooting section covering 12 common build issues:
  - Submodule issues
  - Stale build artifacts
  - CMake version conflicts
  - Python version mismatch
  - Dependency version conflicts
  - Missing python-dev headers
  - Linking errors with --whole-archive
  - XNNPACK build failures
  - Windows symlink errors
  - MSVC kernel compilation failures
  - Intel macOS limitations
  - Duplicate kernel registration
- Build output reference table
- Tips for faster and more reliable builds
Reorganize the building skill to be concise and action-driven rather
than encyclopedic. Key changes:
- Add "do not ask questions" directive — detect and fix env issues automatically
- Make conda the mandatory path (no venvs, no system Python)
- Auto-fix for cmake >= 4.0 and PEP 668 errors
- Default action is `./install_executorch.sh --editable`
- Complete runner table from actual Makefile (adds voxtral, voxtral_realtime,
  sortformer, silero-vad, llava, debug variants)
- Fix macOS commands: $(sysctl -n hw.ncpu) instead of $(nproc)
- Note that --preset macos uses Xcode generator
- Condense troubleshooting into scannable table
- Trim cmake options to most-used flags (full list in CMakeLists.txt)

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Differential Revision: D95846702

Pull Request resolved: pytorch#18021
### Summary
Don't run Samsung jobs which require secrets on forked PRs. They fail.
It looks like they used to be disabled on forks, but this line ended up
getting left commented out after the jobs were disabled and re-enabled.
This PR restores it to the original state.
Summary: I've migrated the codebase to stop using these.

Reviewed By: d16r

Differential Revision: D95810888

Co-authored-by: Adam Ernst <adamjernst@meta.com>
- Add venv fallback when conda is not installed
- Handle conda PermissionError by checking env directory on disk
- Auto-fix cmake: missing or < 3.24 gets pip-installed, >= 4.0 works fine
- Add troubleshooting entries for conda not found and PEP 668 errors
- Remove heavy-handed directive banner; let skill structure guide behavior

Co-authored-by: Claude <noreply@anthropic.com>
Explicit decision tree at the top of Step 2 so Claude routes to the
right section based on keywords (Android, iOS, model names, cmake)
instead of always defaulting to the Python package build.

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Add ANDROID_NDK requirement and verification to Android section
- Fix CMAKE_BUILD_TYPE description: not all presets set it
- Separate build output table by flow (pip vs cmake vs cross-compilation)

Co-authored-by: Claude <noreply@anthropic.com>
Differential Revision: D95862010

Pull Request resolved: pytorch#18063
Three issues that would break a fresh Mac checkout:
- Add Xcode Command Line Tools prerequisite check
- Add conda shell.bash hook for non-interactive shells (Claude Code / CI)
- Add brew install python@3.12 guidance for venv path when only 3.14+ exists

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
Differential Revision: D95904580

Pull Request resolved: pytorch#18025
… builds

Differential Revision: D95739935

Pull Request resolved: pytorch#18000
### Summary
Remove lock on XNNPACK Disabled Workspace Mode. 

### Test plan
See test.


cc @GregoryComer @digantdesai @cbilgin
Summary:
Fix write-heap-buffer-overflow in set_all_to_value triggered via
apply_padding_to_dim, reported by fuzzer (T258811544).

Root causes:
1. Negative padding values silently cast to huge size_t, causing massive
out-of-bounds writes.
2. When out_data advances past out_data_end, the remaining computation
(out_data_end - out_data) wraps around to a huge size_t, causing bounds
checks to incorrectly pass.
3. No error propagation after recursive apply_padding_to_dim calls,
allowing the loop to continue writing after a child call has failed.

Fixes:
- Validate all padding values are non-negative in
check_constant_pad_args.
- Read padding as int64_t and explicitly check >= 0 before casting to
size_t.
- Guard remaining computation with out_data <= out_data_end check at all
three bounds-check sites to prevent size_t wraparound.
- Check ctx.failure_state() after recursive calls and bail out early.
- Remove dead pad_i >= 0 check (always true for size_t).


Differential Revision: D95762335
Updated documentation links for Ethos-U memory modes.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants