Bug 58494 - Native linking failed for ... *Build works on mac though
Summary: Native linking failed for ... *Build works on mac though
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 4.5.0 (15.2)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Prashant [MSFT]
Depends on:
Reported: 2017-07-30 21:20 UTC by Jeremy
Modified: 2017-10-03 16:47 UTC (History)
6 users (show)

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

Output from build (5.61 MB, text/plain)
2017-07-30 21:20 UTC, Jeremy
Sample Project (646.68 KB, application/x-zip-compressed)
2017-08-01 01:05 UTC, Jeremy

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 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 Jeremy 2017-07-30 21:20:02 UTC
Created attachment 23905 [details]
Output from build

I have created an iOS Bindings Library for my cross platform project called iOS.Crop. The native library I'm linking to is TOCropViewController 2.0.12. I used a couple of tutorials for using cocoa pods.


I added the iOS.Crop Bindings Library to the project on my Mac as well as all of the Objective Sharpie commands (obviously). I added the generated ToCropViewController.framework as a Native Reference and updated the APIDefinition and Structs. The iOS.Crop project compiled fine.

I then added a reference to iOS.Crop in my iOS project and made calls to the native library and everything worked fine on my Mac. The problem is when I go back to my windows machine with VS 2017. The native project (iOS.Crop) builds fine, but my iOS project throws the following error (Krizzma.iOS is the name of my iOS project) .

Error		Native linking failed for '/Users/jeremyalley/Library/Caches/Xamarin/mtbs/builds/Krizzma.iOS/77444036d2543f1c892fafac1b7559f2/obj/iPhone/Debug/device-builds/iphone7.2-10.3.2/mtouch-cache/arm64/libiOS.Crop.dll.dylib'. Please file a bug report at http://bugzilla.xamarin.com	Krizzma.iOS	C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets	747	

Microsoft Visual Studio Professional 2017 
Version 15.2 (26430.16) Release
Microsoft .NET Framework
Version 4.7.02046

Installed Version: Professional

Visual Basic 2017   00369-60000-00001-AA948
Microsoft Visual Basic 2017

Visual C# 2017   00369-60000-00001-AA948
Microsoft Visual C# 2017

Visual F# 4.1   00369-60000-00001-AA948
Microsoft Visual F# 4.1

Application Insights Tools for Visual Studio Package   8.6.00404.2
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017   15.0.30503.0
ASP.NET and Web Tools 2017

ASP.NET Web Frameworks and Tools 2017   5.2.50303.0
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   15.0.30209.0
Azure App Service Tools v3.0.0

Azure Data Lake Node   1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio   2.2.5000.0
Microsoft Azure Data Lake Tools for Visual Studio

Common Azure Tools   1.9
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Fabric.DiagnosticEvents   1.0
Fabric Diagnostic Events

JavaScript Language Service   2.0
JavaScript Language Service

KofePackagePackage Extension   1.0
KofePackagePackage Visual Studio Extension Detailed Info

Merq   1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Microsoft Azure Hive Query Language Service   2.2.5000.0
Language service for Hive query

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.50131.1

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Mono Debugging for Visual Studio   Mono.Debugging.VisualStudio
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   4.2.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

SQL Server Data Tools   15.1.61702.140
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript tools for Visual Studio

Xamarin (fec6f88)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android SDK (9dbc4c5)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK (ad35de4)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Comment 1 Prashant [MSFT] 2017-07-31 11:56:13 UTC
Thanks so much for taking the time to submit this report! I’m unable to reproduce this issue using the latest Visual Studio 2017 Preview version 15.3. Please attach the following to help us reproduce this issue: 

-Detailed reproduction steps 

-Version information (Help → About Microsoft Visual Studio → Copy Info) 

-Optional: project to reproduce your issue
Comment 2 Jeremy 2017-08-01 01:05:15 UTC
Created attachment 23927 [details]
Sample Project
Comment 3 Jeremy 2017-08-01 01:07:30 UTC
Thanks for looking into this.  I have attached a sample project.
Comment 4 Jeremy 2017-08-07 22:43:56 UTC
Hi Prashant, any update on this issue?  Is there anything else I can provide?
Comment 6 Prashant [MSFT] 2017-08-29 06:01:24 UTC
# Non Engineering team observations - 

Building solution from VS on Windows and **Mac** fails with following error

> error : Native linking error: framework not found TOCropViewController

While building just a binding project works on both Mac and Windows
Comment 7 Prashant [MSFT] 2017-08-29 06:17:58 UTC

Looks like the attached test case is missing the TOCropViewController.framework
Could you share it with us? It will help us to troubleshoot the issue
Comment 8 Prashant [MSFT] 2017-08-29 06:33:50 UTC
I am marking this bug RESOLVED INVALID. 

In the sample the _TOCropViewController_ static library is targeting devices (armv7 & arm7s), we get build errors on building the project targeting simulator.

To fix this issue - 

Remove TOCropViewController.framework from native references 
Rename `TOCropViewController` to `TOCropViewController.a`
Add TOCropViewController.a to the iOS.Crop project
Use the device build configuration i.e Debug|iPhone or Release|iPhone

@Jeremy, please reopen the bug if you continue to have an issue with the build
Comment 9 Jeremy 2017-08-31 04:28:32 UTC

Thanks again for the assistance.  I followed the steps above and I was able to get the BindingsTest.iOS project to build.  However, when I deploy to my device using Debug|iPhone the app crashes.  If I remove all references to the iOS.Crop project everything works fine.  Were you able to deploy it to a device?  

You mentioned that the static library is targeting devices (armv7 & arm7s).  When I do a lipo -info on the library on my mac, it states the architectures are: armv7 and arm64.  Are you seeing something different?
Comment 10 Prashant [MSFT] 2017-09-04 05:17:33 UTC
> However, when I deploy to my device using Debug|iPhone the app crashes.
 Could you share the new crash logs? I am not able to see this issue.

> Are you seeing something different?

armv7 and arm64 indicate that library is built for devices. I see same output.

Simulator architecture is `i386`
Comment 11 Pierce Boggan [MSFT] 2017-10-03 16:47:04 UTC
Because we have not received a reply to our request for more information in over 14 days, we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information so we can continue looking into this. Thanks!