2

I am making a dynamic framework that requires some c++ libraries from Card IO.

My problem is that because of bitcode, my framework size is too large (more than 150mb) which I think that 3 c++ libraries from Card IO take most.

So I wanted to leave that 3 files to client side (client will need to include them instead of me doing that with my framework) which using my framework => framework size should be reduced some how.

Here is my structure at the moment:

Client Project
-My framework (dynamic)
--Card IO headers
--Card IO c++ libraries (.a) THIS ONE I DON'T WANT TO HAVE HERE (static c++)
-Client code

I tried to weak link with -weak_link the 3 c++ static libraries inside my framework in Other Linker Flags but it failed because Bitcode and weak link are not compatible.

I tried to move the folder of Card IO to client project which it cannot be found (I added path for all like Library Search Path, Framework Search Path... everything)

At this moment, I have no idea how I can do this because I came across a framework from Masterpass that they can leave c++ outside of their framework (client app will need to download and integrate) and also enable Bitcode.

My GOAL: - My framework does not need to include 3 static libraries when building and exporting as .framework - Client project will need to download and include 3 static libraries if they want to use that functionality.

It will be great if someone gives me a hand.

Thanks for reading.

Le Trong Triet
  • 101
  • 1
  • 10
  • I’m not sure if it works, but I think there is a way to define a list of exported symbols and then all other unused code will not be linked. https://stackoverflow.com/a/50608820/909655 – Mats Nov 29 '18 at 16:03
  • What is the problem of giving the client a larger framework? Either way, they are still going to need the static libraries. And you open up the possibility of a mismatch in static lib versions. Or is your goal to deliver the framework and then the static libs separately? And when you say you tried the weak_link, where? When building the framework or the final app that is utilizing the framework? Sorry, it is al little confusing to understand what you trying to say ... your title says "source file" but you go on to list out C++/static libs. – Mobile Ben Nov 29 '18 at 19:29
  • @MobileBen thanks for correcting. Yes, I don't want to include those 3 c++ static libraries when exporting my framework and client will need to include/integrate them when using my framework. I wanted to exclude them because there are many clients who using my framework and complaining also about size. Besides, there are few cases that client even don't want to include them when exporting their IPA file. – Le Trong Triet Nov 30 '18 at 05:19
  • In your Build Phases for building the framework, are the C++ libs listed in "Lib Binary with Libraries"? – Mobile Ben Nov 30 '18 at 07:24
  • @MobileBen Yes for current solution since I still need it to work. Because if I remove it, I will have an error like this clang: error: linker command failed with exit code 1 (use -v to see invocation) – Le Trong Triet Nov 30 '18 at 09:00
  • Besides, I tried to move the whole CardIO folder (including header files and 3 static libs) outside of framework, and move it to client app to see if my framework can recognise it or not. But it only recognises when my framework Mach-o type is static :( – Le Trong Triet Nov 30 '18 at 09:04
  • That is your problem. You should not be linking the static libs in your Framework. If you decide to build it that way, you need to go through the same motions as you want the client. You need to externally link to the static libs in the application. – Mobile Ben Nov 30 '18 at 16:12
  • Sorry if this is a dump question, but how can I externally link static libs with my framework ? Because if I don't include the static libs in "Link Binary and libraries", I will have error right away. – Le Trong Triet Nov 30 '18 at 16:52

0 Answers0