About libsqlcipher.a's size(build for iOS)


I tried to build a lib for iOS version, but I found that the size of libsqlcipher.a is not same when build configuration is Release and Debug.
The size is 7.1Mb when Release,the size is 5.5Mb when Debug.
Who could tell me the reason about size difference.
And how to build a smaller lib for iOS.
Thank you very much.


Dear @hotvodkatea,

Thanks for asking! In Debug configuration your project is likely configured (at least it would be by default) to Build Active Architectures Only. When you build and run locally on your Mac, Xcode builds libsqlcipher.a only for your Mac’s arch, 64-bit (or, if running on your device, your device’s arch). In Release configuration Xcode builds all Architectures specified under Build Settings, accounting for the larger library size. For most iOS projects these days the default ARCHS are armv7 and arm64.

You can check what architectures are in the library you’ve built with the file command. The output looks something like this:

$ file ~/path/to/libsqlcipher.a 
/path/to/libsqlcipher.a: Mach-O universal binary with 5 architectures: [i386: current ar archive random library] [arm_v7s] [arm_v7] [x86_64] [arm64]
/path/to/libsqlcipher.a (for architecture i386)current ar archive random library
/path/to/libsqlcipher.a (for architecture armv7s):	current ar archive random library
/path/to/libsqlcipher.a (for architecture armv7):	current ar archive random library
/path/to/libsqlcipher.a (for architecture x86_64):	current ar archive random library
/path/to/libsqlcipher.a (for architecture arm64):	current ar archive random library

You can see the relevant settings by selecting the project file building the library and clicking on Build Settings.

Hope that helps!