0

I'm using CocoaPods and everythnig works fine until I add Sonic.framework.

I'm getting a linker error:

ld: 96 duplicate symbols for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

Complete log: http://pastebin.com/TqdWWYdt

Any help?

Rizon
  • 1,516
  • 4
  • 25
  • 45

4 Answers4

3

There ,may be some files added multiple times in the project

  • Clear the pod file and pod install : removes everything.
  • Add all the framework into the podfile and call pod install :to install everything again

May be this will fix the issue

Lithu T.V
  • 19,955
  • 12
  • 56
  • 101
3

The conflicting package is most likely AFNetworking, it can be found in the build log you posted (at line 7, duplicate symbol _OBJC_IVAR_$_AFQueryStringPair._field in:.., googling for AFQueryStringPair leads you quickly into AFNetworking related places).

The offending symbol is declared here.

Does Sonic SDK embed AFNetworking by any chance?

It that's the case you might be lucky enough to be able to use the AFNetworking embedded in Sonic SDK, making the problem go away by simply dropping your own dependency on AFNetworking. If AFNetworking is a downstream dependency of one of your other dependencies it will be a bit more tricky. But at least you know where to look.

Edit: Since you have tagged the question with RESTKit too, that might be a more likely culprit than Sonic SDK (see e.g. this) thread.

Jacob Oscarson
  • 6,363
  • 1
  • 36
  • 46
  • This is indeed the problem, SonicSDK includes AFNetworking in the static library so you cannot include your own version, – orta May 27 '13 at 20:11
1

In my case it was caused by an extraneous -l"Pods-AFNetworking" in "Other Linker Flags" in the "Linking" section of my project's Build Settings. I removed this and a few other extraneous -lfoo arguments also in Other Linker Flags: all the duplicate symbols disappeared.

Other things you can check might include:

  • Copying 3rd party software into your app as part of the project's collection of files, and then also adding it as a cocoapod by naming it in the Podfile.

  • Including more than one version of the same 3rd party software in your app.

Don't forget that you can uncheck a file's "Target Membership" checkbox for your target to keep it from being included in your build, so if you need multiple versions for compatibility reasons you can select which files are active by target.

Howard Cohen
  • 135
  • 1
  • 6
0

You may also just be linking against multiple pod libraries. Make sure in Link Binary With Libraries you're not linking against both libPods.a and libPods-{target}, etc

This just happened to me after dividing a blanket podfile into target specific instructions.

eunoia
  • 246
  • 2
  • 10