问题
How to merge the static libraries into single one?
I do have three static libraries libSignatureLibary_armv6.a , libSignatureLibary_armv7.a and libSignatureLibary_i368.a
Now i want to merge this three file into one single library which may be named has libSignatureLibary.a
While Googling I found lipo which is open source tool!
Do i need to run any extra scripting language to merge
or in terminal lipo and pass the parameter for the lipo.
Can any on advice me to build the common library for these three.
@thanks in advance Kiran
回答1:
Open terminal and go to folder with your libs. Then use command:
lipo -create libSignatureLibary_armv6.a libSignatureLibary_armv7.a libSignatureLibary_i368.a -output libSignatureLibary.a
回答2:
lipo command
Create or operate on a universal file: convert a universal binary to a single architecture file, or vice versa.
lipo
from the liposuction
. As you know when you build a project Xcode generate binary for different CPU architectures.
- When a developer wants to share a producer binary as a closed-sorce he should take into account that a client should have a possibility to run/debug a project with this binary on a real device and a simulator. This simple example shows that the developer has to have a tool to merge binary for different arch into a single file -
fat
binary. Another example is when you publish an app to AppStore you can remove unnecessary arch using
-remove
option.If you try to build a project with a binary without necessary arch you get an error[Could not find module for architecture]
Architectures:
- Simulator - x86_64, i386
- Device - armv7, armv7s, arm64
If you try run this command for binaries with the same arch you will get
fatal error: <binary_list> have the same architectures (<arch>) and can't be in the same fat output file
Please note that -create
option do not have parameters
lipo libMy_armv6.a libMy_armv7.a libMy_i368.a -create -output libMy.a
To check existing architectures
lipo -info <binary_path>
//or
file <binary_path>
回答3:
lipo -create libSignatureLibary_armv6.a libSignatureLibary_armv7.a libSignatureLibary_i368.a -output libSignatureLibary.a
来源:https://stackoverflow.com/questions/11120790/merge-static-libraries-into-single