IOS Lib (. A) library conflict resolution

Source: Internet
Author: User

When introducing a third-party Lib (. A) library, it is often caused by the introduction of the same open source code as your existing project in the third-party Lib library. O Conflict, recently in the integration of Han Wang Business card recognition occurred asihttp. o conflict. 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 admin-imac:testlib admin$ Lipo-Info2infile3 

FAT file: Represents the Lib library in which multiple frames have been merged in the Lib library file, where ARMv7 armv7s arm64 is 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 admin-imac:testlib admin$ lipo-extract_family armv7-2 admin-imac:testlib admin$ Lipo- Info  3infile: lib_armv7.a are:armv7 armv7s

View the isolated lib_armv7.a is still a FAT file, only the Non-fat file can be detached. So further separation is still required.

1Admin-imac:testlib admin$ Lipo Lib_armv7.a-thin ARMV7-Output lib_final_armv7.a2Admin-imac:testlib admin$ Lipo Lib_armv7.a-thin armv7s-Output LIB_FINAL_ARMV7S.A3Admin-imac:testlib admin$ Lipo-Infolib_final_armv7.a4InputfileLIB_FINAL_ARMV7.A is not a fatfile5Non-fatfile: lib_final_armv7.a is architecture:armv76Admin-imac:testlib admin$ Lipo-InfoLIB_FINAL_ARMV7S.A7InputfileLIB_FINAL_ARMV7S.A is not a fatfile8Non-fatfile: LIB_FINAL_ARMV7S.A is architecture:armv7s

At this time the separation is already a 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 admin-imac:testlib admin$ Lipo Lib.a-thin arm64-output lib_final_arm64.a2 Admin-imac: Testlib admin$ Lipo-Info3filefile4file: Lib_final_ ARM64.A is architecture:arm64

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

1 admin-imac:testlib admin$ lipo-extract_family i386-output lib_final_i386.a lib.a2 Admin-imac:testlib admin$ Lipo-Info3filefile4file : 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 mkdir armv7 2 admin-imac:testlib admin$ cd armv73ar -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 admin-imac:arm64 admin$ libtool-static-o. /LIBARMV7.A *.O

Other empathy

7. Merging the final common static library

1 admin-imac:testlib admin$ lipo-create-2 admin-imac:testlib admin$ Lipo-Info  3infile: 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.