Bug 58493 - Native linking failed MT5216
Summary: Native linking failed MT5216
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: Mono runtime / AOT compiler (show other bugs)
Version: XI 10.99 (xcode9)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2017-07-30 19:47 UTC by Warren Stephens
Modified: 2017-11-22 15:57 UTC (History)
5 users (show)

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


Attachments
build output (196.33 KB, text/rtf)
2017-07-30 19:47 UTC, Warren Stephens
Details
a different version of the build bug (170.69 KB, text/rtf)
2017-07-31 15:23 UTC, Warren Stephens
Details
3rd version of the build issue (531.68 KB, text/rtf)
2017-07-31 17:23 UTC, Warren Stephens
Details
version info for Visual Studio Community 2017 for Mac (2.16 KB, text/rtf)
2017-07-31 19:19 UTC, Warren Stephens
Details
detailed build info (3.95 MB, text/rtf)
2017-07-31 19:23 UTC, Warren Stephens
Details
version 5 of build errors (2.15 MB, text/rtf)
2017-08-01 11:15 UTC, Warren Stephens
Details

Description Warren Stephens 2017-07-30 19:47:48 UTC
Created attachment 23904 [details]
build output

/Users/warrenstephens/Projects/webRTCforms/iOS/MTOUCH: Error MT5216: 

Native linking failed for 
'/Users/warrenstephens/Projects/webRTCforms/iOS/obj/iPhone/Debug/device-builds/iphone7.2-10.3.3/mtouch-cache/arm64/libWebRTCBinding.dll.dylib'. 

Please file a bug report at http://bugzilla.xamarin.com (MT5216) (webRTCforms.iOS)


======

The build output is attached.
Comment 1 Warren Stephens 2017-07-31 15:23:52 UTC
Created attachment 23910 [details]
a different version of the build bug

This project can be shared if that would be helpful.
Comment 2 Warren Stephens 2017-07-31 16:18:29 UTC
Added "IsCxx=true" to the library's libwebrtc.linkwith.cs file.

That allowed this project to compile and load in the simulator.

Now it generates an exception when running in the simulator:

System.Exception: Could not create an native instance of the type 'webRTC_iOS_binding.RTCICEServer': the native class hasn't been loaded.
It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.
  at Foundation.NSObject.InitializeObject (System.Boolean alloced) [0x0003a] in /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/Foundation/NSObject2.cs:182
  at Foundation.NSObject..ctor (Foundation.NSObjectFlag x) [0x0000d] in /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/Foundation/NSObject2.cs:117
  at webRTC_iOS_binding.RTCICEServer..ctor (Foundation.NSUrl URI, System.String username, System.String password) [0x00000] in /Users/warrenstephens/Projects/webRTC_iOS_binding/webRTC_iOS_binding/obj/Debug/ios/webRTC_iOS_binding/RTCICEServer.g.cs:63
  at webRTCforms.iOS.RTCpeer..ctor (UIKit.UIImageView uiImageDestination) [0x00029] in /Users/warrenstephens/Projects/webRTCforms/iOS/RTCpeer.cs:42
  at webRTCforms.iOS.webRTCimageRenderer.OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs`1[TElement] e) [0x00035] in /Users/warrenstephens/Projects/webRTCforms/iOS/iOSRenderers.cs:39
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00110] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:167
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:116
  at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001b] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:192
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x00009] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:63
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:36
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000cc] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:155
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:116
  at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001b] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:192
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x00009] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:63
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:36
  at Xamarin.Forms.Platform.iOS.ScrollViewRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x0008e] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\ScrollViewRenderer.cs:71
  at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001b] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:192
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x00009] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:63
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:36
  at Xamarin.Forms.Platform.iOS.PageRenderer.ViewDidLoad () [0x00086] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:105
  at at (wrapper managed-to-native) ObjCRuntime.Messaging:IntPtr_objc_msgSendSuper (intptr,intptr)
  at UIKit.UIViewController.get_View () [0x00030] in /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/build/ios/native/UIKit/UIViewController.g.cs:2718
  at Xamarin.Forms.Platform.iOS.PageRenderer.get_NativeView () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:40
  at Xamarin.Forms.Platform.iOS.PageRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x0004f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:55
  at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001b] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:192
  at Xamarin.Forms.Platform.iOS.Platform.AddChild (Xamarin.Forms.VisualElement view) [0x00027] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:326
  at Xamarin.Forms.Platform.iOS.Platform.WillAppear () [0x0003c] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:312
  at Xamarin.Forms.Platform.iOS.PlatformRenderer.ViewWillAppear (System.Boolean animated) [0x00010] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\PlatformRenderer.cs:148
  at at (wrapper managed-to-native) ObjCRuntime.Messaging:void_objc_msgSend (intptr,intptr)
  at UIKit.UIWindow.MakeKeyAndVisible () [0x00010] in /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/build/ios/native/UIKit/UIWindow.g.cs:251
  at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.SetMainPage () [0x00006] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\FormsApplicationDelegate.cs:159
  at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.FinishedLaunching (UIKit.UIApplication uiApplication, Foundation.NSDictionary launchOptions) [0x00028] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\FormsApplicationDelegate.cs:45
  at webRTCforms.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication app, Foundation.NSDictionary options) [0x00013] in /Users/warrenstephens/Projects/webRTCforms/iOS/AppDelegate.cs:19
  at at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/UIKit/UIApplication.cs:79
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/UIKit/UIApplication.cs:63
  at webRTCforms.iOS.Application.Main (System.String[] args) [0x00001] in /Users/warrenstephens/Projects/webRTCforms/iOS/Main.cs:19
Comment 3 Warren Stephens 2017-07-31 17:23:26 UTC
Created attachment 23916 [details]
3rd version of the build issue
Comment 4 Timothy Risi 2017-07-31 17:44:44 UTC
Please include a test case (to reproduce) and all version information.

To get full build logs just set the log verbosity to diagnostic at the following locations:
- On Visual Studio for Mac: Preferences > Projects > Build
- On Visual Studio for Windows: Tools > Options > Projects and Solutions > Build and Run

On Visual Studio Windows you also want to add `-v -v -v -v` to the mtouch additional arguments by right-clicking the project in the solution explorer and selecting `Properties`.
Note: this is done automatically on Visual Studio for Mac when the log verbosity is set to diagnostic.

Easiest way to get exact version information:
- On Visual Studio for Mac: "Visual Studio" menu, "About Visual Studio" item, "Show Details" button.
- On Visual Studio for Windows: "Help menu", "About Microsoft Visual Studio" item.
Then copy/paste the version information (you can use the "Copy Information" button).
Comment 5 Warren Stephens 2017-07-31 19:19:04 UTC
Created attachment 23919 [details]
version info for Visual Studio Community 2017 for Mac
Comment 6 Warren Stephens 2017-07-31 19:23:57 UTC
Created attachment 23920 [details]
detailed build info
Comment 7 Warren Stephens 2017-07-31 19:31:55 UTC
Timothy,

Hey! Thanks for the response.

The whole folder compressed is 1.26GB -- I hope the system can handle it!

Warren
Comment 8 Warren Stephens 2017-07-31 19:34:18 UTC
Apparently the bugzilla system will not take a 1.26GB file.
Comment 9 Timothy Risi 2017-08-01 00:52:06 UTC
Is that with the project cleaned (bin/ and obj/ are usually the biggest folders)
Comment 10 Warren Stephens 2017-08-01 06:58:05 UTC
The project is 625 MB when compressed after the "clean all" -- which is still too big I think.
Comment 11 Warren Stephens 2017-08-01 07:03:34 UTC
It simply looks like the build is not picking up the standard C++ library that the project needs.  

I have tried a lot of options to try to resolve that, but haven't found the correct incantation yet.
Comment 12 Warren Stephens 2017-08-01 11:15:56 UTC
Created attachment 23939 [details]
version 5 of build errors
Comment 13 Warren Stephens 2017-08-01 11:17:57 UTC
In version 5 of the build errors, the problems are all generated from enums.

It seems that these should be easy to fix, but I don't see how.

Thanks for any assistance,

Warren
Comment 14 Manuel de la Peña 2017-09-11 11:12:18 UTC
Ok, maybe we can use a dropbox/onedrive url to share the project and take a look at it. @Tim any input about this. 

Once we have the project we can take a look closer and see if we can reproduce the problem.
Comment 15 Warren Stephens 2017-09-11 13:22:23 UTC
I can share the project if that would help.  Do you have a link?

Another developer (nashzhou) with more binding experience also attempted to do this binding without success -- I think that he used the cocoapod version of webRTC.
Comment 16 Manuel de la Peña 2017-09-11 14:35:56 UTC
You can upload the project where ever is better for you and add the link in a comment. Then I'll try to reduce the size and add it to the bug report or just leave the link.
Comment 18 Manuel de la Peña 2017-10-19 15:20:31 UTC
Hello

I downloaded the project and got the following error:

/Users/mandel/Downloads/webRTC_iOS_binding/webRTC_iOS_binding/CSC: Error CS1566: Error reading resource 'libwebrtc.a' -- 'Could not find a part of the path "/Users/mandel/Downloads/webRTC_iOS_older/mergefolder/fat_libs/libwebrtc.a".' (CS1566) (webRTC_iOS_binding)


Can you please list me all the dependencies I need to test the projects to build them?
Comment 19 Warren Stephens 2017-10-19 16:12:10 UTC
I have uploaded the fat_libs.zip file to dropbox -- which contains the fat_libs folder that is within the mergefolder.

https://www.dropbox.com/s/g4wqjud8ss1qmum/fat_libs.zip?dl=0
Comment 20 Alex Soto [MSFT] 2017-11-21 23:21:00 UTC
Hello Warren, are you still experiencing this issue? I've downloaded all files and tried to build the binding unfortunately while I get an error it is not the same as yours. In order to avoid guessing, could you tell me which CocoaPod is this? Unfortunately looking for WebRTC in CocoaPods brings a lot of libraries.
Comment 21 Warren Stephens 2017-11-22 13:50:02 UTC
I could not figure a way around the problem, so I put the issue aside.  I got the feeling that there was a mismatch between Objective Sharpie and the way that the webRTC folks built their libraries (some mysterious script method as I recall).

I do still have a long term need for this to be solved, and a colleague interested as well (for a government project), but I figured that it would take someone with a deeper knowledge of the underlying library structure to figure out what the mismatch actually is.

I doesn't matter to me which webRTC library is the basis of the solution, just that the webRTC API is usable from Xamarin projects.
Comment 22 Alex Soto [MSFT] 2017-11-22 15:57:13 UTC
The broader developer community would be the best and quickest place for additional troubleshooting help on this issue, unfortunately, this goes beyond the scope of our bugzilla support.

Posting a question on Stack Overflow [0] or the Xamarin Forums [1][2] would be the best next step.

[0] https://stackoverflow.com/questions/tagged/xamarin
[1] https://forums.xamarin.com/categories/ios
[2] https://forums.xamarin.com/categories/mac

(Investigation by the Xamarin team in the bug tracker for an issue like this would usually require that the reporter include additional background info to hint that Xamarin is behaving differently compared to Xcode.)

In case it might also be a helpful reference, you can find some general recommendations on the best places to ask various kinds of questions about Xamarin on:

https://developer.xamarin.com/guides/cross-platform/troubleshooting/support-options/

Note You need to log in before you can comment on or make changes to this bug.