iosxcodelinkerstatic-librariesduplicate-symbol

Duplicate symbol error when linking multiple static libraries.


There are a fair number of related questions out there already, but I'm just not getting this resolved. I'm building an application that includes two separate static libraries: RestKit and another that's on NDA. When I build, I'm getting a Apple Mach-O linker error as follows:

duplicate symbol _NewBase64Decode 
in /Users/geraldwburke/Desktop/iOS Programming/MyApp/someLib.a(NSData+Base64.o) 
and /Users/geraldwburke/Library/Developer/Xcode/DerivedData/MyAppddlwzdeskfwaxyargomvfhurvxzi/Build/Products/Debug-iphoneos/libRestKit.a(NSData+Base64.o) 
for architecture armv7

Now, I've seen some potential fixes out there. This article seemed promising. I also tried to add a build rule using the script from this blog entry. I've tried adding and removing -ObjC, -all_load, and -force_load linker flags. No matter what I have tried, I still get that same error. Does anyone have any idea how to fix this?

BTW I will delete my identical post. Posted it on the wrong acct.


Solution

  • The easiest solution is to modify the source code of one of those libraries to not define NewBase64Decode. RestKit is open source; I don't know if you have the source to your secret NDA library.