6 duplicate symbols for architecture i386

Ali Maisam picture Ali Maisam · Mar 20, 2013 · Viewed 27k times · Source
duplicate symbol _OBJC_METACLASS_$_SBJsonParser in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonParser.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonParser.o)
duplicate symbol _OBJC_CLASS_$_SBJsonParser in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonParser.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonParser.o)
duplicate symbol _OBJC_IVAR_$_SBJsonWriter.sortKeys in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonWriter.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonWriter.o)
duplicate symbol _OBJC_IVAR_$_SBJsonWriter.humanReadable in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonWriter.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonWriter.o)
duplicate symbol _OBJC_METACLASS_$_SBJsonWriter in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonWriter.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonWriter.o)
duplicate symbol _OBJC_CLASS_$_SBJsonWriter in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonWriter.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonWriter.o)
ld: 6 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Please tell me how to fix this issue?

Answer

Nikolai Ruhe picture Nikolai Ruhe · Mar 20, 2013

As you can see the linker complains that SBJsonWriter and SBJsonParser are both defined in libfacebook_ios_sdk.a and as individual files in your project.

You cannot really solve the problem except removing the individual files from your target.

The problem is that the developers of libfacebook_ios_sdk.a thought it would be a good idea to use the json framework (not caring for clashes with code used in the host app). This is a common problem with SDKs on iOS.