How to enable static libraries that have the same names for OBJECT files inside them?

I am developing an iPad application in which I have included two third-party static libraries. The names of the object files in the two libraries are the same. When I create the application, I get

"Error Apple Mach -O (id)"

due to the same object file names in these two libraries. How to solve this problem?

The error looks like this:

ld: duplicate symbol _T_strcpy in /Users/indiait-supportservices/Desktop/untitled folder/Universal/lib/simulator/libSecurIDLib.a(mem.o) and /Users/indiait-supportservices/Library/Developer/Xcode/DerivedData/ReceiverForiOS-aqpprpcivvjjadbsutqqmtjsoczk/Build/Intermediates/ReceiverForiOS.build/Debug-iphonesimulator/myApp iPad.build/Objects-normal/i386/pdcrypte2.o for architecture i386 collect2: ld returned 1 exit status Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-g++-4.2 failed with exit code 1. 
+4
source share
2 answers

Are you building for one architecture? If you build for multiple architectures and use the -all_load linker -all_load , this violates the linker's ability to ignore characters that are defined for multiple architectures. As a test, try building only for armv6 and see if the error persists.

There is a good blog post here and a similar issue being discussed here .

Finally, you can add the following env var to debug problems with overriding categories: OBJC_PRINT_REPLACED_METHODS=YES . This will register the names of methods that have been overridden by categories, just in case this is a problem.

0
source

It looks like you have two modules defining the same function, one in libSecurIDLib.a(mem.o) and pdcrypte2.o . They must be in their own namespaces (C ++), or they must be prefixed so that they do not collide (C).

There is work around if this is not possible, but it is better to name things safely.

0
source

All Articles