IOS lib (. a) Library conflict solution

Source: Internet
Author: User

IOS lib (. a) Library conflict solution
When a third-party lib (. a) Library is introduced, it is often caused by a. o conflict because the third-party lib library introduces the same open source code as your existing project. I would like to say that such open-source code with high usage should not be included in the lib library. If you want to include the source code, you should change the name. However, there is no way for us to separate them.


1. view the supported framework types of the lib library in sequence. I386: simulator, armv7: iphone4, armv7s: iphone5, iphone5s, arm64: iphone6, iphone6p

 

1 robindeMacBook-Pro-2: testlib robin $ lipo-info lib. a 2 ubuntures in the fat file: lib. a are: armv7 armv7s arm64 3 robindeMacBook-Pro-2: testlib robin $ fat file: indicates that the lib library file combines the lib library of multiple frameworks, here the merged armv7 armv7s arm64. If the lib library of the simulator is merged at the same time, the i386 identifier will also appear here.

2. Separate the. a libraries of the armv7 and armv7s types.

 

 

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 ubuntures in the fat file: lib_armv7.a are: armv7 armv7s check that the isolated lib_armv7.a is still a fat file, only Non-fat files can be separated. o. Therefore, 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-liboutput _final_armv7s.a3 robindeMacBook-Pro-2: testlib robin $ lipo-info lib_final_armv7.a4 input file lib_final_armv7.a is not a fat file5 Non-fat file: lib_final_armv7.a is architecture: armv76 robindeMacBook-Pro-2: testlib robin $ lipo-I Nfo lib_final_armv7s.a7 input file lib_final_armv7s.a is not a fat file8 Non-fat file: Unsupported is architecture: armv7s copy Code. At this time, the Non-fat file is separated before the code can be separated. o.

3. Remove the. a library of the arm64 type

 

Arm64 is the latest framework added for iOS. The Non-fat files of arm64 versions cannot be separated by the separation of armv7 and armv7s, after multiple tests, we found that the following commands can be used for direct separation.

 

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 architecture: arm64

4. Separate the. a library of the i386 (simulator) Type

 

 

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. Remove the target file. o
Through the preceding separation, the lib libraries of the armv7, armv7s, arm64, and i386 frameworks can be separated one by one. Then, a folder is created for each framework to save the files from. separated from database. o file. The following uses 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 others likewise

6. Delete the conflicting. o from the separated. o file, and then merge the other. o files into lib (. o)

 

 

1 robindeMacBook-Pro-2: arm64 robin $ libtool-static-o ../libarmv7.a *. o others likewise

7. Merge the final general 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


 

 

 

 

 

Related Article

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.