From: http://blog.k-res.net/archives/1024.html
When there are too many third-party libraries integrated with iOS programs, it is easy to see that several libraries use the same function library at the same time, that is, when your program is linked, the system will prompt duplicate symbol, the repeated symbols are not caused by the code of your own program, so you cannot directly modify the code to remove the repeated symbols! In this case, you need to require the third-party library provider to provide the code, or you need to modify the library files of the third-party library on your own. The first method is somewhat unreasonable, so you can solve it by using the second method, that is, directly modifying the. A file or the library binary file in the framework:
Here I will only list the methods for processing the. A file. The framework procedure is similar.
Open the console, find the. A file to be dissected, and run the following command to view the CPU architecture code contained in the database:
Lipo-Info libx.
Ubuntures In the FAT file: libx. A are: i386 armv6 armv7
Then use the lipo-extract_family armv6-output libx-inter.a libx.
Split the arm version. a. There is a small problem here. According to my understanding, this command should contain three types of CPU code. the armv6 part of A is actually separated. A is a part that contains both armv6 and armv7, that is, it is still "fat" Lib, which cannot be extracted. o, so the following operations are required:
Lipo libx-inter.a-thin armv6-output libx-armv6.a-lipo libx-inter.a-thin armv7-output libx-armv7.a
In this way, two different versions of arm. A can be separated and then the. O operation is performed:
Ar-x libx-armv6.a
It is best to put this operation in a separate folder and link it out. all. O is restored, and there are two options: one is to restore the CPU architecture of all databases to this position, and then combine the duplicate parts into one, run the following command. O and then merged into a public Lib. Another option is to retain a copy of the Lib in the duplicate symbol as it is, and unbind the remaining lib separately to remove the existing one. o, and then link the lib back. A to remove duplicate symbols.
No matter which method is used, the final link return command is as follows:
Libtool-static-o ../libx-armv6.a *. o
Of course, don't forget that our database has multiple CPU architecture commands. Therefore, we must first perform the same operation on the database of each CPU arch, and then merge thin lib back to fat Lib:
Lipo-create-output libx. A libx-armv6.a libx-i386.a libx-armv7.a
In this way, the duplicate symbol will no longer appear when you link your app back.
References:
Solution to duplicate symbol using multiple third-party libraries for http://bbs.51cto.com/topic/thread-845884.html
Http://stackoverflow.com/questions/5352113/how-do-i-turn-a-fat-library-into-a-non-fat-library how do I turn a "fat" library into a "non-fat" library?