Declare StructuredQueriesCore so SQLiteData links as a dynamic framework - #514
Closed
jonphillips wants to merge 1 commit into
Closed
jonphillips wants to merge 1 commit into
jonphillips wants to merge 1 commit into
Conversation
SQLiteData's sources reference StructuredQueriesCore symbols directly, but the target declares only StructuredQueriesSQLite. That is fine for a static build, where every transitive archive is on the same link line anyway, and it breaks once the product is built as a dynamic framework: `@_exported import` is a compile-time re-export rather than `-reexport_framework`, so StructuredQueriesSQLite.framework does not vend StructuredQueriesCore's symbols on SQLiteData.framework's behalf, and the direct references go unresolved. Xcode builds every package product as a dynamic framework as soon as a test bundle enters the graph, so `xcodebuild build-for-testing` fails while `swift build`, `swift test` and a plain `xcodebuild build` all pass.
Author
|
P.S. Love what you guys do. |
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
SQLiteData's sources referenceStructuredQueriesCoresymbols directly, but the target declares onlyStructuredQueriesSQLite. That is fine forswift build/swift test, and it breaks as soon as the product is built as a dynamic framework — which Xcode does for every package product in the graph the moment a test bundle enters the build.This revives #441, which was closed on the understanding that #467 had resolved it. #467 is in 1.6.6; we are on 1.6.6 (and reproduce identically against 1.8.1), and the failure is unchanged. I suspect that reporter's configuration differed — the manifest omission itself is still present on
maintoday.Answering the question from #441
That holds for the compiler and not for the linker.
@_exported importis a compile-time re-export: it makes the names visible to the type checker. It is not-reexport_framework, soStructuredQueriesSQLite.frameworkdoes not vendStructuredQueriesCore's symbols onSQLiteData.framework's behalf. When every product is a separate dylib,SQLiteData.framework's link line contains only its declared dependencies, and the direct references go unresolved.A static build hides it completely, because every transitive archive is on the same link line anyway. That is why
swift build,swift test, and a plainxcodebuild buildare all green whilebuild-for-testingfails — and, I suspect, why this has stayed latent.Reproduction
No complex project needed. The trigger is simply a test bundle in an Xcode graph:
sqlite-dataand defines any@Tabletype.xcodebuild build-for-testing -scheme <App> -destination 'platform=iOS Simulator,...'Step 3 is the whole trick: adding the test bundle flips every package product from static to dynamic. Without it the same project builds clean.
The failure
Note the referencing objects are
SQLiteData.oitself —_SystemFieldsRepresentation,_AllFieldsRepresentation, and theCKSyncEngine.PendingRecordZoneChangeextension — so this is not a consumer reaching through SQLiteData for something; it is SQLiteData's own code needing a library it does not declare.Verification
Applying this change to a local checkout makes
SQLiteData.frameworklink, andbuild-for-testingthen completes.Environment: Xcode 27.0 beta / iOS 27 simulator SDK, sqlite-data 1.6.6 and 1.8.1, swift-structured-queries 0.31.3 and 0.34.0. Both version pairs fail identically and are fixed identically.