Add explicit ServiceContextModule dependency to fix Xcode linker error#893
Closed
William-Laverty wants to merge 2 commits intoswift-server:mainfrom
Closed
Add explicit ServiceContextModule dependency to fix Xcode linker error#893William-Laverty wants to merge 2 commits intoswift-server:mainfrom
William-Laverty wants to merge 2 commits intoswift-server:mainfrom
Conversation
AsyncHTTPClient references ServiceContext.current directly (compiled into the caller from Tracer.withSpan default arguments), but only declared a dependency on Tracing, not on ServiceContextModule. When Xcode builds SPM packages as frameworks, transitive dependencies are not automatically propagated to the linker, causing an undefined symbol error. Add swift-service-context as an explicit package dependency and ServiceContextModule as a target dependency of AsyncHTTPClient. Fixes swift-server#890.
Member
|
I think this is a dupe of #891. |
Member
|
As stated before this is a dupe of #891. |
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
Add
swift-service-contextas an explicit package dependency andServiceContextModuleas a target dependency ofAsyncHTTPClient.Problem
AsyncHTTPClientdirectly referencesServiceContext.current(fromswift-service-context) inHTTPClientRequest+Prepared.swift, and also via the default argument ofTracer.withSpan()calls — Swift compiles default arguments into the caller, soServiceContext.currentgets compiled intoAsyncHTTPClient.o, creating a direct symbol reference toServiceContextModule.However, the package only declares a dependency on
Tracing(fromswift-distributed-tracing), not onServiceContextModuledirectly.When Xcode builds SPM packages as frameworks, transitive dependencies are not automatically propagated to the linker, causing:
Fix
A two-line change to
Package.swift:swift-service-contextas a package dependencyServiceContextModuleas a target dependency ofAsyncHTTPClientThis is the same class of bug as #721 (missing
NIOTLS).Fixes #890.