Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Size of static libraries generated by Xcode

I have a project tree in Xcode that looks like this: AppProject depends on ObjcWrapper which in turn depends on PureCppLib. ObjcWrapper and PureCppLib are static library projects. Combined, all sources barely reach 15k lines of code, and, as expected, the size of resulting binary is about 750Kb in release mode and slightly over 1Mb in debug mode. So far, so good.

However, ObjcWraper.a and PureCppLib.a are over 6Mb each in either mode. So the first question is why it is so. But more importantly, how can I ensure that those static libs do not include parts or all of the source code?

Thanks in advance!

like image 531
user325014 Avatar asked Apr 24 '10 18:04

user325014


People also ask

What is a static library Xcode?

Static library - a unit of code linked at compile time, which does not change.

Does swift support static libraries?

Question: Can we create static frameworks using Swift? Answer: Finally, YES! (Xcode 9). CocoaPods announced the support of Swift Static Frameworks in 1.5.

Where are static libraries stored?

A static library is a file, stored in object code, used to store functions, variables, classes etc… that you may want to use when building a new program.

How do you check if a library is static or dynamic Xcode?

If you are looking at a binary library / framework (perhaps it's precompiled by a 3rd party) and want to know if it's a static or dynamic binary, just use file command with the path to the binary file. Example (static framework) - static binaries are usually marked with ar archive or similar.


1 Answers

You probably want to build your static library without debug symbols. Find the "Generate Debug Symbols" build setting for the static library target in the Configuration you distribute, and make sure it is unchecked.

like image 127
cdespinosa Avatar answered Nov 02 '22 23:11

cdespinosa