Bug 23164 - Starting on XVS.iOS 3.5, "Native linking error: file not found" because native libraries in the project aren't copied to the build host
Summary: Starting on XVS.iOS 3.5, "Native linking error: file not found" because nativ...
Status: RESOLVED DUPLICATE of bug 23635
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: General ()
Version: 3.5
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2014-09-18 16:28 UTC by Cody Beyer (MSFT)
Modified: 2014-11-21 14:12 UTC (History)
7 users (show)

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 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 Cody Beyer (MSFT) 2014-09-18 16:28:20 UTC
When linking to a native assembly, and with the -gcc_flags option, the following errors are occurring:

7>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(325,3): error : Native linking error: warning: directory not found for option '-LC:/source/AviationDirectTest/EasyCockpitMono/EasyCockpitIOS'
7>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(325,3): error : Native linking error: file not found: C:/source/AviationDirectTest/EasyCockpitMono/EasyCockpitIOS/libsqlcipher.a
7>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(325,3): error : Native linking failed. Please review the build log and the user flags provided to gcc: "-LC:/source/AviationDirectTest/EasyCockpitMono/EasyCockpitIOS" "-lsqlcipher" "-force_load" "C:/source/AviationDirectTest/EasyCockpitMono/EasyCockpitIOS/libsqlcipher.a"

It appears that the system is not copying the files to the Mac build host.

Comment 2 Ram Chandra 2014-09-19 05:52:20 UTC
I tried to reproduce this issue but I am not able to reproduce this issue.

Could you please provide us sample project and build information? So that we can reproduce this issue at our end.
Comment 3 Cody Beyer (MSFT) 2014-09-20 17:16:26 UTC
Under version:


Using the following project https://www.dropbox.com/s/g6d18gao3249yqg/LibTest.zip?dl=0
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2014-10-02 03:46:44 UTC
See also the forum thread that corresponds to the Desk case for some further details about the problem:

Details from the forum thread that are likely helpful:

- These build errors started in Xamarin 3.5, meaning that the problem is a regression.

- The same project builds successfully using Xamarin Studio on Mac.

- The full `-gcc_flags` option is:
> -gcc_flags "-L${ProjectDir} -lsqlcipher -force_load ${ProjectDir}/libsqlcipher.a"

Part of the problem (the path names starting with `C:`) is already fixed on the beta channel.

## Steps to reproduce

Attempt to build and deploy the test case from comment 3 in the Debug configuration to a hardware iPhone device.

## Workaround for the test project (using the beta channel Xamarin 3.7.191 + Xamarin.iOS

1. After the first failed build attempt, copy `libmysqlclient.a` by hand into the expected location in the Mac build host output directory (something like [1]).

> [1] /Users/macuser/Library/Caches/Xamarin/mtbs/builds/LibTest/e64276923c69348d53446f527be526b/libmysqlclient.a

2. Rebuild the project from VS.

## Version information

### Windows

Xamarin (8ed3fc1c94db017633cea8d857666d3c27f4d349)
Xamarin.iOS (e934614f2e5a410acb3d62a2994c27a3e770a91e)

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

### Mac build host

Mono 3.10.0 ((detached/47db868)

Xamarin.iOS (Business Edition)
Hash: ff9d4a0
Build date: 2014-10-01 01:14:53-0400

Xcode 6.0.1 (6528), Build 6A317
Mac OS X 10.9.4
Comment 5 Virgile Bello 2014-10-06 04:22:57 UTC
More generally, it would be good to have a way to copy arbitrary files that are needed during build.

Currently, our workaround is to use BundleResource in a target to get them copied. However, since BundleResource also gets it copied in .app folder (even if CopyToOutputDirectory is set to none), we also add <LogicalName>..\libname.a</LogicalName> so that it doesn't get embedded in the app package.
Comment 6 Ram Chandra 2014-10-06 13:47:10 UTC
I am able to reproduce this issue with attached sample.

When I build the attached sample I observed that I am getting "Native linking error:". I have checked the same on mac machine and observed that sample application is working fine on mac machine.

I have also observed that when I manually copied the "libmysqlclient.a" file to the following location and rebuild the application on VS, I am not getting "native link error".


Screencast: http://www.screencast.com/t/vSGSwwow
Error details: https://gist.github.com/anonymous/ae779d7e31ff788195b7
Build Output: https://gist.github.com/anonymous/0786417fc4b540149812
MTBS server logs: https://gist.github.com/saurabh360/12973b52190ca920dc25

Environment Info:

Windows Info :

Windows 7
Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.50938
Installed Version: Professional
Xamarin (7453332649b309b4ecc185a18b2169f00327393e)
Xamarin.Android (3b7ef0a796e8744972c48034403a6e7cb7ec189e)
Xamarin.iOS (13fec5ef6bd1d2992ae58cc5147d0e3f988792ca)

Mac Info:

Mac OS X 10.9.5
Xamarin Studio: 5.5 (build 227)
Mono 3.10.0 ((detached/633e444)
GTK+ 2.24.23 (Raleigh theme)
Xcode 6.0.1 (6528)
Xamarin.iOS: (Business Edition)
Comment 7 Virgile Bello 2014-10-07 02:46:48 UTC
Ideally, I would like to see this fixed more generally as part of bug 23635 (https://bugzilla.xamarin.com/show_bug.cgi?id=23635).
Comment 8 Adrian Alonso 2014-10-20 13:19:06 UTC
We will support the CopyToOutput property to define which files should be copied to the OutputPath in the mac as part of the fix for the bug 23635.

*** This bug has been marked as a duplicate of bug 23635 ***