ios resolves conflicts with two static libraries duplicate symbol

Source: Internet
Author: User

Scene:

Resolving conflicts between Tencentopenapi.framework and ZBARSDK in _base64_encode functions


Later on the network search, delete the other Linker Flag-all_load can solve the problem of static library conflict,

But doing so will invalidate some external static libraries, using the OBJC extension function (catagory) method. such as Baidumapapi

If some libraries are using extension functions (catagory), you can load the library separately

Use:-force_load

-force_load BAIDUMAPAPI/LIBS/RELEASE-IPHONEOS/LIBBAIDUMAPAPI.A

(Baidumapapi is added to the current directory)

Or

-force_load $ (built_products_dir)/libxxx.a

(This is the direct addition of static library project source code practice)

It is very convenient to use-force_load to load separately, if some functions add the main function to use All_load is quite troublesome.

The above can solve the conflict between Tencentopenapi.framework and ZBARSDK.

If the structure of the two static library conflicts is the same, consider splitting up the two static libraries for merging.

See what the schema of the file is
$ lipo-info LIBZBAR.A
Architectures in the Fat File:libzbar.a are:armv7 (Cputype () Cpusubtype (one)) i386

Unzip the armv7 out Lipo Libzbar.a-thin armv7-output libzbar-armv7.a Create a new folder to store the extracted (. O) files
$ mkdir ARMV7
$ CD ARMv7 to extract the files from the static library $ ar-x. /libzbar-armv7.a


Then the other static library based on the above steps to do it again, and then observe the decompression of the static library, there are those that are the same merge together, but note that the two static library conflict (. o) file must be consistent, otherwise there will be an error.

Packaged after the merger
$ libtool-static-o.. /LIBNEW-ARMV7.A *.O


If you are using the same steps as in a virtual machine, merge the i386 schema together again. Merging static libraries
$ lipo-create-output LIB.A libnew-armv76.a libi386.a reprint:Figthing's Bloghttp://blog.163.com/023_dns/blog/static/118727366201391544630380/

ios resolves conflicts with two static libraries duplicate symbol

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.