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.
What and why?
Swift Package Manager encourages us to leave library type for itself to decide either
dynamic
orstatic
Yet, it doesn't change to use
dynamic
when needed.Example case
We have 3 targets:
App
: linksDatadog
,Framework1
andFramework2
Framework1
: linksDatadog
Framework2
: linksDatadog
When we
build App
, Xcode emits the following error:Solution
Either
Package.swift
todynamic
orDISABLE_DIAMOND_PROBLEM_DIAGNOSTIC
build setting to silence the errorWe implemented the change in
Package.swift
in this PRImportant note
Xcode builds App Extensions and alikes without this problem (unless symbols are duplicated in binaries)
That makes the example case above an edge case IMO
Conclusion
Given that the error occurs only in an edge case, giving up on static linking may not be the best solution.
I suggest not fixing the issue and
README.md
orTROUBLESHOOT.md
)Review checklist