1

I'm wanting to use two Objective-C libraries in a MonoTouch app: the Facebook library and an ad library from Millennial Media.

When I try to compile my MonoTouch app (even just for the simulator), I get the error:

ld: duplicate symbol _OBJC_CLASS_$_SBJsonParser in /var/folders/4s/lcvdj54x0g72nrsw9vzq6nm80000gn/T/tmp6024c613.tmp/libMMSDK_4.5.5.a(SBJsonParser.o) and /var/folders/4s/lcvdj54x0g72nrsw9vzq6nm80000gn/T/tmp6024c613.tmp/libFacebookSDK.a(SBJsonParser.o) for architecture i386
collect2: ld returned 1 exit status

I assume both libraries are using SBJsonParser and that's the issue.

So then I tried putting them in the same MonoTouch binding project, but still got the exact same error.

My bindings came from the Xamarin binding projects on GitHub. Here is what linker flags are setup:

[assembly: LinkWith ("libMMSDK_4.5.5.a", LinkTarget.ArmV6 | LinkTarget.ArmV7 | LinkTarget.Simulator, Frameworks = "CoreGraphics QuartzCore MediaPlayer CoreLocation MobileCoreServices AudioToolbox AVFoundation SystemConfiguration UIKit", ForceLoad = true)]

...

[assembly: LinkWith ("libFacebookSDK.a", LinkTarget.Simulator | LinkTarget.ArmV6 | LinkTarget.ArmV7, ForceLoad = true, Frameworks = "CoreGraphics")]

Is there something I can do to fix this? Maybe an extra MonoTouch compiler flag?

jonathanpeppers
  • 26,115
  • 21
  • 99
  • 182
  • Some clues here: http://stackoverflow.com/questions/6130568/issues-when-installing-th-json-framework-on-xcode4 Can this be fixed on the MonoTouch side? Or will I have to recompile XCode projects here? – jonathanpeppers Jun 21 '12 at 13:22

1 Answers1

1

Ok, found a workaround.

The Millenial Media SDK, had a folder named MMSDK_Split_Libraries, peeking inside I found a libMMSDK_4.5.5_withoutJSON.a file, complete with SBJsonParser implementation files for XCode. Using this different library, at least my app compiles now. I haven't integrated the MM SDK yet, so I will have to see if it works properly or not.

Curious to see if someone out there has another way to fix it.

jonathanpeppers
  • 26,115
  • 21
  • 99
  • 182