Bug 16993 - Duplicate Symbol in Partial (filename+<some-name>.o) Classes
Summary: Duplicate Symbol in Partial (filename+<some-name>.o) Classes
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: 7.1.0.x
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-12-30 15:12 UTC by Ralph Jourdan Barro
Modified: 2014-01-06 08:01 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Sample iOS Binding Project (77 bytes, text/plain)
2014-01-02 11:33 UTC, Ralph Jourdan Barro

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Ralph Jourdan Barro 2013-12-30 15:12:01 UTC
Hello Xamarin,

I am having this error in my test iPhone app for my iOS Binding Project:

Error MT5212: Native linking failed, duplicate symbol: '_OBJC_METACLASS_$_AFJSONParser'. (MT5212) (AerisMap) 
Error MT5213: Duplicate symbol in: /Users/danielknoodle/Documents/AerisMap/AerisMapTest/obj/iPhoneSimulator/Debug/mtouch-cache/Aeris.a(AFJSONParser+JSONKit.o) (Location related to previous error) (MT5213) (AerisMap)
Error MT5213: Duplicate symbol in: /Users/danielknoodle/Documents/AerisMap/AerisMapTest/obj/iPhoneSimulator/Debug/mtouch-cache/Aeris.a(AFJSONParser+SBJSON.o) (Location related to previous error) (MT5213) (AerisMap)

As we know, an obj.c file that has + sign works similar to a partial class in c#. (please correct me if i'm wrong). i wonder why AFJSONParser+JSONKit.o and AFJSONParser+SBJSON.o are treated as different classes.

Here is the documentation of the objective-c library that i need to bind. http://www.hamweather.com/support/documentation/mobile/
Comment 1 Atin 2014-01-02 05:37:46 UTC
I have tried to reproduce this issue but i am not able to reproduce this. 

Could you please attached sample application? So that we can reproduce this issue.
Comment 2 Ralph Jourdan Barro 2014-01-02 11:33:36 UTC
Created attachment 5744 [details]
Sample iOS Binding Project

Hello Xamarin,

Thank you for responding to my bug entry.
Please check the link to my sample project.
As you will see, there are no compilation errors in the iOS Binding Project.
The problem occurs when i use the resulting dll to the test project.
Comment 3 Rolf Bjarne Kvinge [MSFT] 2014-01-06 08:01:46 UTC
This is a problem with the native library, it wasn't built correctly (there are duplicated methods in it).

You can work around this by adding the following to all the LinkWith attributes in the binding project:

    [assembly: LinkWith (..., SmartLink = true)]

and then add the following to the additional mtouch arguments in the iOS Build options of the main project:


Alternatively you can ask the vendor of the native library to provide a properly built library (this problem can be reproduced in an Xcode sample by disabling dead strip for the linker and adding -load_all as an extra linker flag).