Native linking failed

sursur USMember ✭✭
edited August 2017 in Xamarin.iOS

Hello Xamarin Forums users,

we have a problem with our app. We recently got a new Fujitsu SDK to add proper support for their new bluetooth printers. The SDK is incompatible with Fujitsus older printer models, so we need to compile our app with their new SDK and their older SDK to support the older printers. But when we try to compile our app with both SDKs, we get following errors:

/Users/daw/Documents/OwiGo_Smart/src/ios/MTOUCH: Error MT5212: Native linking failed, duplicate symbol: '_FCLReceivedNotificationForMultiplePrinters'. (MT5212) (OwiGo.Smart.iOS)
/Users/daw/Documents/OwiGo_Smart/src/ios/MTOUCH: Error MT5212: Native linking failed, duplicate symbol: '_FCLReceivedNotification'. (MT5212) (OwiGo.Smart.iOS)
/Users/daw/Documents/OwiGo_Smart/src/ios/MTOUCH: Error MT5212: Native linking failed, duplicate symbol: '_EADSessionDataReceivedNotification'. (MT5212) (OwiGo.Smart.iOS)

With each of the listed errors come 2 MT5213 error messages pointing out the duplicate symbol. Please note that this SDK is from Fujitsu, therefore we don't have access to the source code of their library. Editing the library itself is not an option. We already tried the solution to enable SmartLink for both libraries and add --registrar:static in the additional mtouch arguments. Our app compiles then, but executing any method from those libraries fails with the following exception (caught by our app):

2017-08-09 11:51:27.428 OwiGoSmartiOS[7800:7143720] 11:51:27|999 |Fehler: Wrapper type 'OwiGo.Smart.Fujitsu.FTP2176000N0_IOSLibrary' is missing its native ObjectiveC class 'FTP2176000N0_IOSLibrary'.
2017-08-09 11:51:27.435 OwiGoSmartiOS[7800:7143720] 11:51:27|999 |Stack: ObjCRuntime.RuntimeException: Wrapper type 'OwiGo.Smart.Fujitsu.FTP2176000N0_IOSLibrary' is missing its native ObjectiveC class 'FTP2176000N0_IOSLibrary'.
  at Registrar.DynamicRegistrar.OnRegisterType (Registrar.Registrar+ObjCType type) [0x00113] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/ObjCRuntime/DynamicRegistrar.cs:796 
  at Registrar.Registrar.RegisterTypeUnsafe (System.Type type, System.Collections.Generic.List`1[System.Exception]& exceptions) [0x010b5] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/ObjCRuntime/Registrar.cs:1890 
  at Registrar.Registrar.RegisterType (System.Type type, System.Collections.Generic.List`1[System.Exception]& exceptions) [0x00011] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/ObjCRuntime/Registrar.cs:1064 
  at Registrar.DynamicRegistrar.Register (System.Type type) [0x00002] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/ObjCRuntime/DynamicRegistrar.cs:1138 
  at ObjCRuntime.Class.Register (System.Type type) [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/ObjCRuntime/Class.cs:161 
  at ObjCRuntime.Class.GetHandle (System.Type type) [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/ObjCRuntime/Class.cs:129 
  at Foundation.NSObject.AllocIfNeeded () [0x00015] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/Foundation/NSObject2.cs:478 
  at Foundation.NSObject..ctor (Foundation.NSObjectFlag x) [0x00006] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/Foundation/NSObject2.cs:116 
  at OwiGo.Smart.Fujitsu.FTP2176000N0_IOSLibrary..ctor () [0x00000] in <a0afe39184d74d569a0f8d6546d23ea2>:0 
  at App.DruckJobIOS_Fujitsu_Base+<Drucken>c__AnonStorey1+<Drucken>c__AnonStorey0.<>m__0 () [0x00001] in /Users/daw/Documents/OwiGo_Smart/src/klassen/App/iOS/cDrucken.cs:4190 
  at Foundation.NSActionDispatcher.Apply () [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/Foundation/NSAction.cs:57 
  at (wrapper managed-to-native) ObjCRuntime.Messaging:void_objc_msgSend_IntPtr_IntPtr_bool (intptr,intptr,intptr,intptr,bool)
  at Foundation.NSObject.InvokeOnMainThread (System.Action action) [0x00007] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/Foundation/NSObject2.cs:560 
  at App.DruckJobIOS_Fujitsu_Base+<Drucken>c__AnonStorey1.<>m__0 () [0x00092] in /Users/daw/Documents/OwiGo_Smart/src/klassen/App/iOS/cDrucken.cs:4188 

We are currently using Xamarin.iOS 10.3.1.8 with Xamarin Studio 6.1.1.7 and Mono Framework 4.6.2. I included a build log with this post for further analysis.

Thank you in advance for your help.

EDIT: Disabling Force Load in the Linking Settings to make the library behave like in Objective-C Apps did not help either. It lead to the same exception as shown above.

Sign In or Register to comment.