Xcode 9: Linking a static framework against another static framework
In the spirit of Xcode 9's "revolutionary" feature, namely compiling static frameworks, we are trying to make our subprojects build as static frameworks, so they can be linked statically against the main application target.
One of our sub-projects has a static framework dependency itself (Firebase). When we build the sub-project as a dynamic framework, everything works fine, but once we switch it to mach-o staticlib, suddenly, it loses the Firebase library symbols.
Here is the output of nm
for building our subproject as a dynamic vs static framework, respectively:
dynamic:
00000000001c3450 S _OBJC_CLASS_$_FIRApp
static:
U _OBJC_CLASS_$_FIRApp
The problem is, both cases the framework builds "successfully", but complains about missing symbols once it is linked against another target (test target for example). How do we make sure all symbols from Firebase frameworks are embedded into out sub-project when it itself is a static framework? We tried -all_load
, -ObjC
linker flags without avail...
Disclaimer: Still searching for the final answer.
After using static frameworks more, I now realize they don't get automagically merged by the linker, same way they get merged into an executable/dynamic target.
I end up linking all static frameworks, and their sub-dependencies, against the main target anyway.
There should be a way to merge static frameworks, without making the final framework a dynamic lib, alas, the search continues...
链接地址: http://www.djcxy.com/p/76418.html