Add module anchor to fix empty dynamic framework on Xcode 26#436
Merged
Lukasa merged 4 commits intoapple:mainfrom Apr 20, 2026
Merged
Add module anchor to fix empty dynamic framework on Xcode 26#436Lukasa merged 4 commits intoapple:mainfrom
Lukasa merged 4 commits intoapple:mainfrom
Conversation
On Apple platforms every source file in the Crypto target compiles to just `@_exported import CryptoKit`, producing zero exported symbols. Xcode 26 changed how SPM packages are built for test targets: each package product in the dependency graph is built as a separate dynamic framework. A module with no symbols produces a framework directory but no Mach-O binary, and the linker fails. Add a minimal public enum `_CryptoModuleAnchor` (outside the conditional compilation guard) so the module always has at least one exported symbol, regardless of how it is linked. Fixes apple#435
Lukasa
requested changes
Apr 17, 2026
Contributor
Lukasa
left a comment
There was a problem hiding this comment.
I think we can achieve this by providing a single func as a @usableFromInline or _@spi symbol which better achieves the outcome. Please also put this file into a BoringSSL directory, to ensure it is preserved across updates.
- Replace public enum _CryptoModuleAnchor with a single @usableFromInline internal func _cryptoModuleAnchor() so the anchor symbol does not appear in the public API surface. - Move the file under Sources/Crypto/Util/BoringSSL/ to ensure it is preserved across upstream syncs.
Contributor
Author
|
Thanks for the review @Lukasa! Addressed both points in ee838cf:
|
Lukasa
approved these changes
Apr 18, 2026
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
Fixes #435.
On Apple platforms every source file in the
Cryptotarget compiles to just@_exported import CryptoKit(becauseCRYPTO_IN_SWIFTPMis defined butCRYPTO_IN_SWIFTPM_FORCE_BUILD_APIis not), producing zero exported symbols.Xcode 26 changed how SPM packages are built for test-target dependencies: each package product is built as a separate dynamic framework. A module with no symbols generates a
.frameworkdirectory but no Mach-O binary, causing a linker error:Fix
Added a minimal
_CryptoModuleAnchorpublic enum (outside the conditional compilation guard) so the module always produces at least one exported symbol, regardless of how it is linked. The type is prefixed with_to signal it is not intended for public use.Test plan
swift-crypto(or a transitive dependency likeswift-certificates) as apackageProductDependencyon Xcode 26 targeting iOS Simulator — should now succeedswift test)