Fix: Add explicit swift-service-context dependency for Xcode 26 transitive dylib bug#891
Merged
fabianfett merged 2 commits intoswift-server:mainfrom Feb 25, 2026
Conversation
…itive dylib bug Xcode 26 builds all "automatic" SPM package products as dynamic frameworks but does not propagate transitive framework dependencies. This causes undefined symbol errors for ServiceContextModule when AsyncHTTPClient is used as a transitive dependency. Adding the explicit dependency resolves this. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fabianfett
approved these changes
Feb 25, 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.
Problem
Xcode 26 introduced a regression in Swift Package Manager builds where packages built as dynamic frameworks don't properly propagate transitive framework dependencies during the link phase.
Symptoms
When AsyncHTTPClient is used as a transitive dependency (i.e., Package A → Package B → AsyncHTTPClient), the build fails with:
Root Cause
*.framework)ServiceContextModule(via inlined code fromTracing)Package.swiftdoesn't declareswift-service-contextas a direct dependencyswift-distributed-tracing, which itself depends onswift-service-contextServiceContextModule.frameworkintoTracing.frameworkAsyncHTTPClient.frameworkAsyncHTTPClient.oreferences ServiceContextModule symbols but the framework doesn't link against itSolution
Add explicit package-level and target-level dependencies for
swift-service-contextto ensure Xcode 26 can link the framework correctly.Changes
.package(url: "https://github.com/apple/swift-service-context.git", from: "1.1.0")to package dependencies.product(name: "ServiceContextModule", package: "swift-service-context")toAsyncHTTPClienttarget dependenciesAsyncHTTPClientTeststarget for test buildsImpact
ServiceContextModulewas already available transitively throughTracingTesting
Verified that this fixes builds for projects with dependency chains like:
Previously failed with undefined symbols, now builds and links correctly.
Related Issue: This is a workaround for an Xcode 26 regression. Ideally Apple would fix the SPM dylib linking behavior, but adding explicit dependencies is a reasonable defensive practice regardless.