I'm trying to properly setup a new package dependency to an inner static lib in a project, but get linking errors & the workaround I have is quite ugly.
Here's the structure:
Project 1/Static Lib A
|
Project 2/Framework B
|
Project 2/App C
App C depends/links on Framework B, which depends/links on Static Lib A. All are Xcode targets in 2 distinct projects (see graph above).
In Static Lib A, I need to add a Swift-Algorithms dependency. I'm adding it as a Pack Dependency (Xcode feature) to the static lib target, add some code using it in the lib, then build the whole project. With no other changes, Framework B fails to link with duplicate symbols from Swift-Algorithms which apparently is being statically linked twice (Lib A, Framework B). If I remove Swift-Algorithms from the Lib A link phase and add it as a standard dependency there (no link), Framework B fails to link with missing symbols. I can make it link by manually adding Swift-Algorithms to Framework B's link phase. But that's not a clean workaround, because both Swift-Algorithms deps (Lib A, Framework B) have to be manually maintained with matching version in distinct projects.
Is this a limitation of the tools (Xcode 13.4) when using Swift packages? Are there any workaround? The project is complex and I can't easily change the structure nor switch to SPM (it's on our roadmap for the next few months with Xcode 14).
Thanks.