Bug 61235 - I am getting Error in Visual Studio Version 7.2 For Native Linking Error
Summary: I am getting Error in Visual Studio Version 7.2 For Native Linking Error
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: master
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
URL:
: 61236 ()
Depends on:
Blocks:
 
Reported: 2018-02-24 11:08 UTC by Tusshar
Modified: 2018-03-07 14:39 UTC (History)
4 users (show)

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

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:
Status:
RESOLVED NOT_REPRODUCIBLE

Description Tusshar 2018-02-24 11:08:39 UTC
Please look into this, I am getting this error from one week i could not found any solution to resolve it.

Below are the details of Build output: 


/Users/mac/Desktop/Tusshar/PsnAmcApp/packages/Xam.Plugin.Connectivity.1.0.2/lib/Xamarin.iOS10/Connectivity.Plugin.Abstractions.dll -r /Users/mac/Desktop/Tusshar/PsnAmcApp/packages/Xam.Plugin.Connectivity.1.0.2/lib/Xamarin.iOS10/Connectivity.Plugin.dll -r "/Users/mac/Desktop/Tusshar/PsnAmcApp/App12/App12/Dukpt DLL/Dukpt.dll" -r /Users/mac/Desktop/Tusshar/DukptClassLibrary.dll -r /Users/mac/Desktop/Tusshar/PsnAmcApp/packages/ExifLib.PCL.1.0.1/lib/portable-net45+sl50+win+WindowsPhoneApp81+wp80+Xamarin.iOS10+MonoAndroid10+MonoTouch10/ExifLib.dll -r /Users/mac/Desktop/Tusshar/PsnAmcApp/App12/App12/MagtekiDynamoDLL/MagtekDynamo.dll -r /Users/mac/Desktop/Tusshar/PsnAmcApp/packages/Microsoft.Net.Http.2.2.29/lib/Xamarin.iOS10/System.Net.Http.Extensions.dll -r /Users/mac/Desktop/Tusshar/PsnAmcApp/packages/Microsoft.Net.Http.2.2.29/lib/Xamarin.iOS10/System.Net.Http.Primitives.dll -r /Users/mac/Desktop/Tusshar/PsnAmcApp/packages/Xamarin.Forms.1.4.2.6359/lib/Xamarin.iOS10/Xamarin.Forms.Core.dll -r /Users/mac/Desktop/Tusshar/PsnAmcApp/packages/Xamarin.Forms.1.4.2.6359/lib/Xamarin.iOS10/Xamarin.Forms.Platform.dll -r /Users/mac/Desktop/Tusshar/PsnAmcApp/packages/Xamarin.Forms.1.4.2.6359/lib/Xamarin.iOS10/Xamarin.Forms.Platform.iOS.dll -r /Users/mac/Desktop/Tusshar/PsnAmcApp/packages/Xamarin.Forms.1.4.2.6359/lib/Xamarin.iOS10/Xamarin.Forms.Xaml.dll -r /Users/mac/Desktop/Tusshar/PsnAmcApp/packages/XLabs.Core.2.0.5610.2/lib/portable-net45+netcore45+wp8+MonoAndroid1+MonoTouch1/XLabs.Core.dll -r /Users/mac/Desktop/Tusshar/PsnAmcApp/packages/XLabs.Forms.2.0.5610.2/lib/Xamarin.iOS10/XLabs.Forms.dll -r /Users/mac/Desktop/Tusshar/PsnAmcApp/packages/XLabs.Forms.2.0.5610.2/lib/Xamarin.iOS10/XLabs.Forms.iOS.dll -r /Users/mac/Desktop/Tusshar/PsnAmcApp/packages/XLabs.IoC.2.0.5610.2/lib/portable-net45+netcore45+wp8+MonoAndroid1+MonoTouch1/XLabs.Ioc.dll -r /Users/mac/Desktop/Tusshar/PsnAmcApp/packages/XLabs.Platform.2.0.5610.2/lib/Xamarin.iOS10/XLabs.Platform.dll -r /Users/mac/Desktop/Tusshar/PsnAmcApp/packages/XLabs.Platform.2.0.5610.2/lib/Xamarin.iOS10/XLabs.Platform.iOS.dll -r /Users/mac/Desktop/Tusshar/PsnAmcApp/packages/XLabs.Serialization.2.0.5610.2/lib/portable-net45+netcore45+wp8+MonoAndroid1+MonoTouch1/XLabs.Serialization.dll --target-framework Xamarin.iOS,v1.0 /Users/mac/Desktop/Tusshar/PsnAmcApp/App12/App12.iOS/bin/iPhoneSimulator/Debug/App12iOS.exe -v -v 
    MTOUCH : warning MT1302: Could not extract the native library 'libMTSCRA.a' from '/Users/mac/Desktop/Tusshar/PsnAmcApp/App12/App12.iOS/obj/iPhoneSimulator/Debug/device-builds/iphone10.4-11.1/mtouch-cache/libMTSCRA.a'. Please ensure the native library was properly embedded in the managed assembly (if the assembly was built using a binding project, the native library must be included in the project, and its Build Action must be 'ObjcBindingNativeLibrary').
    Process exited with code 1, command:
    /Applications/Xcode 9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++  -framework Security -framework UIKit -framework Foundation -framework AudioToolbox -framework QuartzCore -framework CoreGraphics -framework CloudKit -framework GLKit -framework OpenGLES -framework SystemConfiguration -weak_framework Intents -weak_framework CoreFoundation -weak_framework CFNetwork /Users/mac/Desktop/Tusshar/PsnAmcApp/App12/App12.iOS/obj/iPhoneSimulator/Debug/device-builds/iphone10.4-11.1/mtouch-cache/x86_64/main.o /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libmonosgen-2.0.a /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libxamarin-debug.a -force_load /Users/mac/Desktop/Tusshar/PsnAmcApp/App12/App12.iOS/obj/iPhoneSimulator/Debug/device-builds/iphone10.4-11.1/mtouch-cache/libMTSCRA.a -force_load /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libapp.a -Wl,-pie -arch x86_64 -gdwarf-2 -std=c99 -I/Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/SDKs/MonoTouch.iphonesimulator.sdk/usr/include -isysroot '/Applications/Xcode 9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk' -Qunused-arguments -fobjc-legacy-dispatch -fobjc-abi-version=2 -mios-simulator-version-min=8.0 -lz -liconv -o /Users/mac/Desktop/Tusshar/PsnAmcApp/App12/App12.iOS/bin/iPhoneSimulator/Debug/device-builds/iphone10.4-11.1/App12iOS.app/App12iOS -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/mac/Desktop/Tusshar/PsnAmcApp/App12/App12.iOS/obj/iPhoneSimulator/Debug/device-builds/iphone10.4-11.1/Entitlements.xcent -u _xamarin_timezone_get_data -u _xamarin_GetFolderPath -u _xamarin_log -u _CreateZStream -u _CloseZStream -u _Flush -u _ReadZStream -u _WriteZStream -u _xamarin_start_wwan -u _UIApplicationMain -u _xamarin_get_block_descriptor -u _xamarin_IntPtr_objc_msgSend_IntPtr -u _xamarin_IntPtr_objc_msgSendSuper_IntPtr -u _mono_pmip -u _xamarin_dyn_objc_msgSend -u _xamarin_dyn_objc_msgSendSuper -u _xamarin_dyn_objc_msgSend_stret -u _xamarin_dyn_objc_msgSendSuper_stret
    ld: file not found: /Users/mac/Desktop/Tusshar/PsnAmcApp/App12/App12.iOS/obj/iPhoneSimulator/Debug/device-builds/iphone10.4-11.1/mtouch-cache/libMTSCRA.a
    clang : error : linker command failed with exit code 1 (use -v to see invocation)
    
    error MT5209 : Native linking error : file not found: /Users/mac/Desktop/Tusshar/PsnAmcApp/App12/App12.iOS/obj/iPhoneSimulator/Debug/device-builds/iphone10.4-11.1/mtouch-cache/libMTSCRA.a
    MTOUCH : error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/mac/Desktop/Tusshar/PsnAmcApp/App12/App12.iOS/obj/iPhoneSimulator/Debug/device-builds/iphone10.4-11.1/Entitlements.xcent
    MTOUCH : error MT5202: Native linking failed. Please review the build log.
Done building target "_CompileToNative" in project "PaymentServiceNetwork.iOS.csproj" -- FAILED.

Done building project "PaymentServiceNetwork.iOS.csproj" -- FAILED.

Build FAILED.

/Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(2003,5): warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190.
ExtendedButtonRenderer.cs(64,17,64,26): warning CS0618: 'Label.Font' is obsolete: 'Please use the Font attributes which are on the class itself. Obsoleted in v1.3.0'
ExtendedButtonRenderer.cs(136,79,136,88): warning CS0618: 'Label.Font' is obsolete: 'Please use the Font attributes which are on the class itself. Obsoleted in v1.3.0'
ExtendedButtonRenderer.cs(155,72,155,81): warning CS0618: 'Label.Font' is obsolete: 'Please use the Font attributes which are on the class itself. Obsoleted in v1.3.0'
MTOUCH : warning MT1302: Could not extract the native library 'libMTSCRA.a' from '/Users/mac/Desktop/Tusshar/PsnAmcApp/App12/App12.iOS/obj/iPhoneSimulator/Debug/device-builds/iphone10.4-11.1/mtouch-cache/libMTSCRA.a'. Please ensure the native library was properly embedded in the managed assembly (if the assembly was built using a binding project, the native library must be included in the project, and its Build Action must be 'ObjcBindingNativeLibrary').
clang : error : linker command failed with exit code 1 (use -v to see invocation)
error MT5209 : Native linking error : file not found: /Users/mac/Desktop/Tusshar/PsnAmcApp/App12/App12.iOS/obj/iPhoneSimulator/Debug/device-builds/iphone10.4-11.1/mtouch-cache/libMTSCRA.a
MTOUCH : error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/mac/Desktop/Tusshar/PsnAmcApp/App12/App12.iOS/obj/iPhoneSimulator/Debug/device-builds/iphone10.4-11.1/Entitlements.xcent
MTOUCH : error MT5202: Native linking failed. Please review the build log.
    5 Warning(s)
    4 Error(s)

Time Elapsed 00:00:31.45

---------------------- Done ----------------------

Build: 4 errors, 6 warnings
Comment 1 Alex Soto [MSFT] 2018-02-24 16:59:58 UTC
The issue is the following

MTOUCH : warning MT1302: Could not extract the native library 'libMTSCRA.a' from '/Users/mac/Desktop/Tusshar/PsnAmcApp/App12/App12.iOS/obj/iPhoneSimulator/Debug/device-builds/iphone10.4-11.1/mtouch-cache/libMTSCRA.a'. Please ensure the native library was properly embedded in the managed assembly (if the assembly was built using a binding project, the native library must be included in the project, and its Build Action must be 'ObjcBindingNativeLibrary').

Do you have a binding project of libMTSCRA.a? If so, could you share with us the the binding project by attaching it here or use a service like OneDrive/Dropbox?

Cheers!
Comment 2 Alex Soto [MSFT] 2018-02-24 17:04:47 UTC
*** Bug 61236 has been marked as a duplicate of this bug. ***
Comment 3 Alex Soto [MSFT] 2018-02-24 17:06:11 UTC
Also please share with us you full version information

The 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 4 Tusshar 2018-02-26 09:31:28 UTC
Hi All,
      Below are the details for my Binding project, Please look in to this Zip file, How I can correct this to make executable code :

https://github.com/Tusshark/Binding-Native-Library-MTSCRA-or-Magtek

On This Url I have uploaded my complete project files to generate DLL file, but when I run this in my main application on that time it's giving me Native linking Error, Not in this project that I have uploaded on this Url.

Please let me know if any issue with that you have.
Comment 5 Tusshar 2018-03-07 11:54:58 UTC
Hi All,
      Below are the details for my Binding project, Please look in to this Zip file, How I can correct this to make executable code :

https://github.com/Tusshark/Binding-Native-Library-MTSCRA-or-Magtek

On This Url I have uploaded my complete project files to generate DLL file, but when I run this in my main application on that time it's giving me Native linking Error, Not in this project that I have uploaded on this Url.

Please let me know if any issue with that you have.
Comment 6 Vincent Dondain [MSFT] 2018-03-07 14:39:04 UTC
Hi,

The error you're getting is indicating a misconfiguration of you binding project. "Please ensure the native library was properly embedded in the managed assembly (if the assembly was built using a binding project, the native library must be included in the project, and its Build Action must be 'ObjcBindingNativeLibrary')."

The test case you linked here doesn't have any native reference or embedded native library, it is not a valid way for us to reproduce your issue. I'd recommend looking at https://developer.xamarin.com/guides/ios/advanced_topics/binding_objective-c/walkthrough, it will guide you on how to use the Native Reference folder in VSMac and get a binding project working.

However you might have succeeded in that already? https://github.com/Tusshark/Magtek-DLL-Sammple-Application from https://bugzilla.xamarin.com/show_bug.cgi?id=61243 seems to be constructed properly but still doesn't show your issue...

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 or that a previous version of the platform (given the same test case) was working properly.

I have to remind you that bugzilla isn't a support channel, it is for bugs specific to the Xamarin.iOS platform. Please ask the broader developer community for additional troubleshooting help on this issue.
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

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/