Skip to content

Fix XCFramework CI build after upstream merge#23

Merged
pacowong merged 8 commits into
developfrom
paco/fix-xcframework-ci-build
Jul 15, 2026
Merged

Fix XCFramework CI build after upstream merge#23
pacowong merged 8 commits into
developfrom
paco/fix-xcframework-ci-build

Conversation

@pacowong

Copy link
Copy Markdown
Collaborator

Two changes to restore CI compatibility after the upstream merge brought in a refactored build_apple_framework.py:

  1. Replace pip install -r requirements-dev.txt with pip install -r ios_packaging/requirements.txt (just flatbuffers). The full dev requirements include clang-format and other heavy packages that are not needed for framework builds and can fail on newer macOS runners.

  2. Introduce goodnotes_maccatalyst_build_settings.json, a GoodNotes-specific settings file separate from the upstream default_full_ios_framework_build_settings.json. This lets us maintain our own settings (e.g. FETCHCONTENT_TRY_FIND_PACKAGE_MODE=NEVER for macabi to prevent CMake from picking up incompatible Homebrew packages on GitHub-hosted runners) without conflicting with future upstream merges.

Description

Motivation and Context

GoodNotesCI and others added 8 commits July 15, 2026 19:52
Two changes to restore CI compatibility after the upstream merge
brought in a refactored build_apple_framework.py:

1. Replace `pip install -r requirements-dev.txt` with
   `pip install -r ios_packaging/requirements.txt` (just flatbuffers).
   The full dev requirements include clang-format and other heavy
   packages that are not needed for framework builds and can fail on
   newer macOS runners.

2. Introduce goodnotes_maccatalyst_build_settings.json, a
   GoodNotes-specific settings file separate from the upstream
   default_full_ios_framework_build_settings.json. This lets us
   maintain our own settings (e.g. FETCHCONTENT_TRY_FIND_PACKAGE_MODE=NEVER
   for macabi to prevent CMake from picking up incompatible Homebrew
   packages on GitHub-hosted runners) without conflicting with future
   upstream merges.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Explains why the file exists and what to check when syncing upstream
changes to default_full_ios_framework_build_settings.json.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
The GitHub-hosted macOS runners have CMake 4.x installed via Homebrew.
CMake 4 removed compatibility with cmake_minimum_required values < 3.5,
so the psimd dependency (pulled in transitively by XNNPACK → pthreadpool)
fails with:

  Compatibility with CMake < 3.5 has been removed from CMake.

Adding CMAKE_POLICY_VERSION_MINIMUM=3.5 tells CMake to accept these old
sub-project declarations, which is what the original GoodNotes settings
had before the upstream merge overwrote the file.

Also document this flag (and the macabi FETCHCONTENT flag) in the workflow
comment so future syncs know to preserve both.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Mirror the same three fixes already applied to the GitHub Actions workflow:

- Drop 'brew install cmake' (was installing CMake 4.x, causing the psimd
  cmake_minimum_required error) and rely on the pre-installed CMake.
- Use ios_packaging/requirements.txt instead of requirements-dev.txt
  (avoids installing heavy packages unneeded for framework builds).
- Switch to goodnotes_maccatalyst_build_settings.json so that
  CMAKE_POLICY_VERSION_MINIMUM=3.5 and FETCHCONTENT_TRY_FIND_PACKAGE_MODE=NEVER
  are included for macabi builds.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
CMake is not pre-installed on CircleCI macOS runners so removing it
broke the build entirely. Brew installs CMake 4.x which is now safe
since CMAKE_POLICY_VERSION_MINIMUM=3.5 is in the settings file.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
The upstream CoreML availability macros in host_utils.h only declared
macOS and iOS availability — missing macCatalyst. Clang treats any API
usage as unguarded when building for a macCatalyst deployment target,
producing -Werror,-Wunguarded-availability-new errors for:
  - MLMultiArrayDataTypeFloat16      (macCatalyst 16+)
  - MLComputeUnitsCPUAndNeuralEngine (macCatalyst 16+)
  - MLOptimizationHints and related  (macCatalyst 17.4/18+)

Fix:
1. host_utils.h: add maccatalyst(N) to all API_AVAILABLE_COREML* and
   HAS_COREML*_OR_LATER macros so Clang recognises the guards.

2. model.mm: wrap the two unguarded CoreML 6 API usages with
   HAS_COREML6_OR_LATER; use #pragma clang diagnostic to silence the
   warning inside ConfigureOptimizationHints, which is only ever called
   from within if (HAS_COREML8_OR_LATER) at the call site.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
GitHub Actions: add an 'upload build error logs' step that runs only on
failure and uploads CMakeError.log / CMakeOutput.log from all intermediate
build directories. Keyed per matrix variant so static and dynamic logs
are separate artifacts.

CircleCI: pipe build output to /tmp/build_output.log (always uploaded)
and collect CMake error logs into /tmp/cmake_logs on failure. Both are
stored as job artifacts for easy download.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
For macabi (Mac Catalyst) builds, the Xcode CMake generator is
unsupported, so Ninja/Make is used instead. Without Xcode, CMake does
not place the dynamic framework under the <config>-macabi subdirectory
— it lands directly under the config build dir as:
  Release/onnxruntime.framework

The refactored build_apple_framework.py (upstream PR microsoft#27279) always
expects the path with the subdirectory:
  Release/Release-macabi/onnxruntime.framework

causing lipo to fail with "can't open input file" during xcframework
assembly. The old script had an explicit fallback for this case; restore
it as a post-build check so lipo uses the correct path.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@pacowong
pacowong merged commit 8067f0b into develop Jul 15, 2026
8 of 9 checks passed
@pacowong
pacowong deleted the paco/fix-xcframework-ci-build branch July 15, 2026 16:00
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.

1 participant