apple: ship dSYMs and preserve macOS framework structure#614
Open
powerworr wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Apple distribution issues for the generated cactus XCFrameworks by ensuring macOS framework bundles retain their symlinked Versions/ structure and by shipping/declaring dSYMs so Xcode/App Store tooling can find debug symbols.
Changes:
- Preserve macOS framework bundle structure by copying frameworks with
ditto(instead ofcp -R, which resolves symlinks). - Adjust header placement to respect versioned framework layouts (
Versions/A/Headers+ top-levelHeaderssymlink when applicable). - Emit, bundle, and declare dSYMs in XCFramework slices (CMake Xcode attribute + copying
.dSYMintodSYMs/+DebugSymbolsPathinInfo.plist).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Two issues caused App Store distribution warnings/errors when the cactus xcframeworks were embedded into a Mac app archive. 1. Malformed macOS framework bundle. `cp -R` follows symlinks, so it flattened cmake's properly-symlinked Versions/A layout into duplicate real files at both the top level and inside Versions/A. Apple's archive validator rejects this with: "Multiple binaries share the same codesign path". Switched to `ditto`, which preserves bundles correctly. `cp_headers` now writes to Versions/A/Headers on macOS and adds the matching top-level Headers symlink when missing; iOS continues to use the flat layout. 2. No dSYMs. cmake's Xcode generator defaults DEBUG_INFORMATION_FORMAT to `dwarf` for Release, so the binary ships stripped of debug info. This produces "Upload Symbols Failed: archive did not include a dSYM" warnings and unsymbolicated crash reports for cactus frames. Added DEBUG_INFORMATION_FORMAT=dwarf-with-dsym, copy the resulting .dSYM next to the framework inside each xcframework slice, and declare DebugSymbolsPath in the xcframework Info.plist so xcodebuild recognizes the dSYM bundle. The Info.plist change is required: without DebugSymbolsPath, Xcode ignores any dSYMs sitting in the xcframework even if they're present. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: viktorstojanov <powerworr@gmail.com>
fb8f830 to
b078fd1
Compare
Collaborator
|
@powerworr thanks for this! Just cleanup the comments in your code and I'll merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two distinct bugs in
apple/build.shcause App Store / TestFlight distribution to fail or warn when the cactus xcframeworks are embedded into a Mac app archive. Both are root-caused and fixed in this PR.Bug 1 — Malformed macOS framework bundle (blocks archive)
build_frameworkcopies the cmake-built framework withcp -R. On macOS, cmake's Xcode generator produces a proper bundle layout:cp -Rresolves symlinks, so the destination ends up with two real binaries — one at the top level and one insideVersions/A/. Apple's archive validator rejects this with:Fix: switch to
ditto, which is bundle-aware on macOS and preserves the symlink layout intact.cp_headerswas also writing top-levelHeaders/regardless of platform; updated it to writeVersions/A/Headersand create the top-level symlink on macOS while keeping iOS's flat layout.Bug 2 — No dSYMs in the xcframeworks (warnings, unsymbolicated crashes)
cmake's Xcode generator defaults
DEBUG_INFORMATION_FORMATtodwarffor Release configurations. The shipped binary is stripped of debug info — confirmed viadwarfdump --uuid+dsymutil(warning: no debug symbols in executable). Consumers see two warnings during App Store upload:Crash reports inside cactus frames also show unsymbolicated hex addresses.
Fix:
-DCMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsymso cmake emitscactus.framework.dSYMnext to each built framework..dSYMinto each xcframework slice under<slice>/dSYMs/cactus.framework.dSYM/.DebugSymbolsPathin the xcframeworkInfo.plistfor everyAvailableLibrariesentry. Without this key, xcodebuild ignores dSYMs sitting in the xcframework even when present.Resulting xcframework layout
Test plan
bash apple/build.shon macOS arm64 with Xcode + cmake installedcactus-macos.xcframework/macos-arm64/cactus.framework/Versions/Currentis a symlink toAcactus-macos.xcframework/macos-arm64/dSYMs/cactus.framework.dSYM/exists and contains DWARF datacactus-ios.xcframeworkfor an iOS appNotes
cactusFlutter package on pub.dev also bundles a separatecactus_util.xcframeworkwith the same structural bug. That binary is built somewhere outside this repo (I couldn't locate the source) — if the same patterns can be applied to wherever it's built, that would resolve the issue end-to-end for Flutter consumers.🤖 Generated with Claude Code