IOS lib (. a) Library conflict solution, ios.

Source: Internet
Author: User

IOS lib (. a) Library conflict solution, ios.

When introducing third-party lib (. a) Library is often caused by the introduction of the same open source code as your existing project in the third-party lib library. o conflict. ASIHttp occurred recently when the Hanwang business card was integrated. o conflict. 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 admin-imac:testlib admin$ lipo -info lib.a 2 Architectures in the fat file: lib.a are: armv7 armv7s arm64 3 admin-imac:testlib admin$ 

Fat file: indicates that the lib library of multiple frameworks is merged in the lib library file. Here, armv7 armv7s arm64 is merged. 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 admin-imac:testlib admin$ lipo -extract_family armv7 -output lib_armv7.a lib.a 2 admin-imac:testlib admin$ lipo -info lib_armv7.a 3 Architectures in the fat file: lib_armv7.a are: armv7 armv7s

Check that the split lib_armv7.a is still a fat file, and only the Non-fat file can be separated. o. Therefore, further separation is still required.

1 admin-imac:testlib admin$ lipo lib_armv7.a -thin armv7 -output lib_final_armv7.a2 admin-imac:testlib admin$ lipo lib_armv7.a -thin armv7s -output lib_final_armv7s.a3 admin-imac:testlib admin$ 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 admin-imac:testlib admin$ 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

In this case, the Non-fat file can be detached. 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 admin-imac:testlib admin$ lipo lib.a -thin arm64 -output lib_final_arm64.a2 admin-imac:testlib admin$ 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 admin-imac:testlib admin$ lipo -extract_family i386 -output lib_final_i386.a lib.a2 admin-imac:testlib admin$ 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 admin-imac:testlib admin$ mkdir armv72 admin-imac:testlib admin$ cd armv73 admin-imac:armv7 admin$ ar -x ../lib_final_armv7.a

Similarly

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

1 admin-imac:arm64 admin$ libtool -static -o ../libarmv7.a *.o

Similarly

7. Merge the final general static library

1 admin-imac:testlib admin$ lipo -create -output libs.a libarmv7.a libarmv7s.a libarm64.a 2 admin-imac:testlib admin$ 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.