static library has big size

2019-05-11 08:58发布

问题:

I built universal static library with help of this template

The problem that is my library libWrapper.a has size 1.3 mb??? :0 while my source code has 130 kb.

How I can reduce the size of my static lib?

Other strange thing -

Each lib has the same size - 1.3 mb. I supposed that universal (fat) libs should have bigger size.

回答1:

Also make sure that you set Generate Debug Symbols to NO in your build settings. This can reduce the size of your static library by about 30%.



回答2:

in terminal run

strip -x [youStaticlib.a]

Description

For dynamic shared libraries, the maximum level of stripping is usually
 -x (to remove all non-global symbols).

if you want to know strip other parameter, in terminal run

man strip


回答3:

You cant. Static libraries include all the code that they reference in the form of frameworks inside their executable.