Xcode version: 15.2, iOS deployment target 15.0
When experimenting with the new Xcode 15/new linker feature "Mergable Libraries" I came across an issue with subproject framework products.
I have a workspace with two projects.
I want to create a group framework named GroupFramework that consists of three other frameworks. FrameworkA, FrameworkB and FrameworkC.
FrameworkA and FrameworkB are in the same project as the group framework I want to create. FrameworkC is a product of another project in my workspace.
GroupFramework has all three frameworks linked in the "link binary with libraries" build phase.
GroupFramework has "Create merged binary" set to manual because I want to control which frameworks are linked. FrameworkA, FrameworkB and FrameworkC all have "Build mergeabe library" set to YES.
The application builds in both RELEASE and DEBUG.
Running in DEBUG and RELEASE
When running the application on a device in DEBUG or RELEASE it crashes with a linker error because FrameworkC can't be found on disk.
When inspecting the app binary in RELEASE I can see that FrameworkA and FrameworkB are both in the ReexportedBinary folder, but FrameworkC is nowhere to be seen.
I have tried embedding FrameworkC explicitly in the settings of the GroupFramework essentially creating an umbrella framework, and that also does not fix the issue.
I have also tried embedding FrameworkC directly into the AppTarget that will consume GroupFramework. This solves the linking issue but a new issue regarding unresolved symbols then crops up.
It appears as though the Reexporting and Merging of subproject frameworks is not working compared to a product that exists in the same project or at least may require a lot more manual configuration which is not currently documented anywhere. If this is the case, it could be very problematic when trying to adopt mergeable libraries in multi-project workspaces.
Replying to my own post for future me (and other developers).
After a few days of digging and investigating, this turned out to be a bug in Xcode 15 and has been fixed in 15.3. The releases notes are below:
Fixed a bug where in a workspace with multiple projects, if a target is configured to merge the binaries of its immediate dependencies into its binary, it would not see that those dependencies were built as mergeable if they were in different projects from itself. (115400802) (FB13160508)
If you can't update to Xcode 15.3 for whatever reason there's a fiddly workaround I pieced together.
On your mergeable binary (in my example FrameworkC) ensure that the "Build mergeable library setting is set to "Release" only and is set to "No" for debug.
On the consuming framework (in my example GroupFramework) you can explicitly add the required linker options to merge the binary.
Wl, -merge_framework, FrameworkC