Skip to content

Conversation

@guitaripod
Copy link

@guitaripod guitaripod commented Jan 27, 2026

Fixes #130

Problem

  1. Framework name mismatch: Sentry-Dynamic.xcframework contains Sentry.framework, but xtool looked for Sentry-Dynamic.framework

  2. FAT static detection: FAT binaries (0xCAFEBABE) containing static archive slices were misidentified as dynamic

Solution

  1. Added findFrameworkName() to scan binDir when expected framework name doesn't exist, matching by binary header or prefix

  2. Enhanced isStaticBinary() to parse FAT headers and check slice magic (!<arch>\n) instead of just checking outer magic

Verification

# Framework name resolution
Sentry-Dynamic.xcframework/ios-arm64/ contains Sentry.framework (not Sentry-Dynamic.framework)
Build log shows: "Copying Sentry.framework" ✓

# Binary detection
Static Sentry:  FAT (cafebabe) → slice @ 48    → !<arch>\n  → static ✓
Dynamic Sentry: FAT (cafebabe) → slice @ 32768 → cffaedfe   → dynamic ✓

Test Plan

Linux

  • Unit test isStaticBinary() - correctly identifies static vs dynamic
  • Unit test findFrameworkName() - resolves Sentry-DynamicSentry
  • xtool builds successfully

macOS

  • Verify xcframework contains mismatched name (Sentry.framework inside Sentry-Dynamic.xcframework)
  • Verify static Sentry is FAT binary with archive slices
  • Verify dynamic Sentry is FAT binary with Mach-O slices
  • Framework name resolution works (build log: "Copying Sentry.framework")
  • Full e2e build blocked by unrelated bug (empty stub.c)

@guitaripod guitaripod marked this pull request as draft January 27, 2026 11:23
Fixes xtool-org#130

- Add frameworkName parameter to binaryTarget resource to handle
  xcframework name mismatches (e.g., Sentry-Dynamic.xcframework
  containing Sentry.framework)
- Add findFrameworkName() to scan binDir for matching frameworks
  when the expected name doesn't exist
- Add isStaticBinary() with FAT Mach-O detection to correctly
  identify FAT binaries (0xCAFEBABE/0xCAFEBABF) containing static
  archive slices, preventing incorrect embedding
@guitaripod guitaripod force-pushed the fix-sentry-package-bugs branch from eabc6df to e4c1959 Compare January 27, 2026 11:24
@guitaripod guitaripod marked this pull request as ready for review January 27, 2026 11:45
@guitaripod guitaripod marked this pull request as draft January 27, 2026 13:07
@guitaripod guitaripod marked this pull request as ready for review January 27, 2026 13:12
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.

Issues using the Sentry package

1 participant