I have libX which links with libA, and libY which also links with libA. Now I need to use libX and libY in the same project, so they’re linked into the same app. For the sake of argument, let’s say libA is 5 MB in size and I’m building an iOS app.
I’ve read here that there are no conflicts between the libs in such a situation because the libA in this example will be included in both libX and libY. But that will also increase the App’s size significantly by 10 MB, instead of 5 MB.
What would I need to do in order to not include libA twice in the App? Is there a compiler switch for that?
Other than that, is there anything I can do in terms of how the libraries are setup and divided into Xcode projects, so that I end up with libA being linked only once? For example, can I build libX and libY without linking to libA, assuming that the final project will add libA as a linked library?
Normally, I would just build libA as dynamic library, but as far as I understand that isn’t allowed on iOS.
AFAIK it is wrong to say that “libX links to libA” for static libraries. Static library is just an archive of object files. Actual linking accuses when linking the app. So no duplicate libs.