IOS Lib (. A) library conflict resolution

Source: Internet
Author: User

When a third-party Lib (. A) library is introduced, it is often caused by the introduction of the same open source code as your existing project in the third-party Lib library. O conflicts. What I want to say is that the source code, like this one, is not supposed to be included in the Lib library, even if you want to include it, you have to change the name. But there is no way that now that people contain, we have to think of ways to separate.


1. Review the framework types supported by the Lib library. I386: Simulator, armv7:iphone4,armv7s:iphone5,iphone5s,arm64:iphone6,iphone6p

1 robindemacbook-pro-2:testlib robin$ lipo-info LIB.A 2 architectures in the Fat FILE:LIB.A are:armv7 armv7s arm64 3 ro Bindemacbook-pro-2:testlib robin$ FAT file: Represents the Lib library in which multiple frames have been merged in the Lib library file, where ARMv7 armv7s arm64 are merged. If you combine the Lib library of the emulator at the same time, there will also be a i386 identity.

2. Isolate the. A library of the armv7,armv7s type.

1 robindemacbook-pro-2:testlib robin$ lipo-extract_family armv7-output lib_armv7.a LIB.A 2 robindeMacBook-Pro-2: Testlib robin$ lipo-info lib_armv7.a 3 architectures in the Fat file:lib_armv7.a are:armv7 armv7s View Discover the isolated lib_armv7.a still is a FAT file, only non-fat files can be detached. So further separation is still required.

Copy Code

1 robindemacbook-pro-2:testlib robin$ Lipo Lib_armv7.a-thin armv7-output lib_final_armv7.a2 robindeMacBook-Pro-2: Testlib robin$ Lipo Lib_armv7.a-thin armv7s-output lib_final_armv7s.a3 robindemacbook-pro-2:testlib robin$ lipo-info li b_final_armv7.a4 input file lib_final_armv7.a is not a fat file5 non-fat file:lib_final_armv7.a is architecture:armv76 r  Obindemacbook-pro-2:testlib robin$ lipo-info lib_final_armv7s.a7 input file lib_final_armv7s.a is not a fat file8 Non-fat FILE:LIB_FINAL_ARMV7S.A is architecture:armv7s the copy code is now separated from the Non-fat file, can be separated. O.

3. Separation of arm64 type. A library

Arm64 is the latest addition to iOS system framework, according to the way to separate armv7,armv7s arm64 version of the Non-fat file can not be separated, after many experiments have been found to be directly separated by the following command.

1 robindemacbook-pro-2:testlib robin$ Lipo Lib.a-thin arm64-output lib_final_arm64.a2 robindemacbook-pro-2:testlib robin$ lipo-info lib_final_arm64.a 3 input file lib_final_arm64.a is not a fat file4 non-fat file:lib_final_arm64.a is a Rchitecture:arm64

4. Separation of the I386 (simulator) type. A library

1 robindemacbook-pro-2:testlib robin$ lipo-extract_family i386-output lib_final_i386.a lib.a2 robindeMacBook-Pro-2:  Testlib robin$ lipo-info lib_final_i386.a 3 input file lib_final_i386.a is not a fat file4 non-fat file:lib_final_i386.a Is architecture:i386


5. Detach the target file. O
Through the above separation can be armv7, armv7s, arm64, i386 frame Lib library one by one, and then for each framework to create a separate folder to save from the. A library separated. o files. Let's take armv7 as an example:

1 robindemacbook-pro-2:testlib robin$ mkdir armv72 robindemacbook-pro-2:testlib robin$ cd armv73 robindemacbook-pro-2: ARMv7 robin$ ar-x. /LIB_FINAL_ARMV7.A Other Empathy

6. Remove the conflicting. O from the isolated. O and merge the remaining. o files into Lib (. O)

1 robindemacbook-pro-2:arm64 robin$ Libtool-static-o. /LIBARMV7.A *.O Other Empathy

7. Merging the final common static library

1 robindemacbook-pro-2:testlib robin$ lipo-create-output libs.a libarmv7.a libarmv7s.a libarm64.a 2 robindeMacBook-Pro- 2:testlib robin$ lipo-info LIBS.A 3 architectures in the Fat FILE:LIBS.A are:armv7 armv7s arm64






IOS Lib (. A) library conflict resolution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.