IOS development references the processing method when a third-party library has duplicate symbol, iosduplicate

Source: Internet
Author: User

IOS development references the processing method when a third-party library has duplicate symbol, iosduplicate
This article is my own Sina Blog extracted from the original link: http://blog.sina.com.cn/s/blog_dcc636350102wat5.html in iOS development, it is inevitable to integrate other third-party class libraries, when there are too many integrated third-party libraries, it is inevitable that some libraries use the same function library at the same time, resulting in an error message "duplicate symbol" during link. See the figure below for details:

This error makes us feel very troublesome. Repeated file errors are not caused by code in our own program, but by third-party libraries of others. That is to say, in this case, we cannot solve the problem by modifying our code. We can only ask a third party (the provider of the function library) to provide the source code, modify it by ourselves, or let the Third Party code provider modify it for us. In any case, we may feel a little unreasonable. Then we can only find a solution, that is, to modify the. a file or the binary file in the framework. To modify this error, we need to use the lipo and ar tools. If you do not know the usage, you can search for it online. Now let's modify it. 1. Find the duplicate library file (find one of the two library files repeatedly, and find two of the three library files ,..... and so on), you can perform operations directly in the folder under the project (it is not recommended to easily cause program problems), and you can also copy these library files to other folders for operations. Copy the file to another folder. The file to be copied is shown in the following figure:

2. Open the terminal and cd it to the folder. Use lipo-info ASIAIDCardReader (replace ASIAIDCardReader with your own file name) to view the architecture information in the file, 3. You can view the last line of information. the ubunturesin the fat file indicates that the file is a fat file. We need to slim down the file first, the armv7, arm64, and armv7s files are separated. Use the command lipo ASIAIDCardReader-thin armv7-output ASIAIDCardReader. armv7 (ASIAIDCardReader. in armv7, ASIAIDCardReader can be replaced with its own file name, which can be customized. modify armv7 to the corresponding Architecture Information suffix), and separate other files.

4. The files have been separated. Next we will use the ar tool to view the binary files (. o files) under each file ). Here we can use ar-t to view all. o files in the terminal.

You can also use ar-x to separate all. o files from the specified directory folder.

Based on our initial error locating, we can easily find duplicate files, such as AsyncSocket. o and AsyncSocket. Next we will modify the separated files. 5. Run the ar-d-sv ASIAIDCardReader command. armv7s AsyncSocket. o, that is, deleting ASIAIDCardReader. asyncSocket in armv7s. o binary file (you only need to replace it with your own library file name and.. arm64 ,. armv7s performs the same operation.

6. After the file is modified, We need to merge all the modified files into the fat file under our original framework. Use the command lipo-create-output ASIAIDCardReaderASIAIDCardReader. armv7sASIAIDCardReader. arm64 ASIAIDCardReader. armv7 (all separated files need to be added here) in order to ensure that the ASIAIDCardReader file is restored, we will delete the file in the copy folder and then perform operations. After using the command, we can see that a new ASIAIDCardReader file is generated. This is the file that meets our requirements after modification. 7. Drag the modified file to the original folder and replace the original file. Note: You can repeat other frameworks by following the preceding methods. Okay, according to this method, I solved my own problem, what is wrong, but also hope you give more advice, finally, this tutorial with blog: http://angelolloqui.com/blog/31-How-to-fix-a-Duplicated-Symbols-error-on-binary-files

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.