Bug 29839 - [3.11] Native Linking Error when trying to link a static library in iOS
Summary: [3.11] Native Linking Error when trying to link a static library in iOS
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 3.11 (C5)
Hardware: PC Mac OS
: High major
Target Milestone: 3.11.1 (C5SR1)
Assignee: Bugzilla
URL:
: 30262 ()
Depends on:
Blocks:
 
Reported: 2015-05-07 10:54 UTC by John Miller [MSFT]
Modified: 2015-10-19 09:48 UTC (History)
13 users (show)

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


Attachments
Log files (29.70 KB, application/zip)
2015-05-07 11:59 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details


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:
Status:
VERIFIED FIXED

Description John Miller [MSFT] 2015-05-07 10:54:38 UTC
**Overview:**

   Native linking an iOS static library fails when using XVS with file not found and directory not found errors. 
**Steps to Reproduce:**

   1. Run the attached project in VS 2013. 
   2. Connect to build host. 
   3. Build the App project.

**Actual Results:**

Error	4	Native linking error: file not found: C:/NativeLinkTesting/NativeLinkTesting/libVidyoClientLib.a	NativeLinkTesting
Error	3	Native linking error: warning: directory not found for option '-LC:/NativeLinkTesting/NativeLinkTesting'	NativeLinkTesting
Error	5	Native linking failed. Please review the build log and the user flags provided to gcc: -LC:/NativeLinkTesting/NativeLinkTesting -lVidyoClientLib -force_load C:/NativeLinkTesting/NativeLinkTesting/libVidyoClientLib.a	NativeLinkTesting
Error	6	Native linking failed. Please review the build log.	NativeLinkTesting


**Expected Results:**

   Compiles successfully.

**Build Date & Platform:**

   XVS 3.11
   XI 8.10

**Additional Information:**

   The same project can be opened in XS on Mac and it will build successfully.
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2015-05-07 11:59:19 UTC
Created attachment 11119 [details]
Log files

## Partial workaround

The following workaround works for me on XamarinVS 3.11.445 + Xamarin.iOS 8.10.0.267 (remove the > greater-than character from the beginning of the line):

> <MtouchExtraArgs>-gcc_flags "-L${TargetDir}/../../../ -lVidyoClientLib -force_load ${TargetDir}/../../../libVidyoClientLib.a"</MtouchExtraArgs>


### Further explanation

The idea is to replace `${ProjectDir}` with one of the other "special variables" that is valid in the MtouchExtraArgs field. The current behavior of these variable seems to _mostly_ match the "Results on XVS 3.8.150" in Bug 25758, Comment 3. The problem is that the `${ProjectDir}` variable has reverted to expanding to the wrong `C:` path (similar to what happened around XVS 3.5 per Bug 23164, Comment 0).



## Optional simpler test case

The test case and steps to reproduce from Bug 25758, Comment 0 are sufficient to reproduce this problem. (And that test case is 100% code that I created from scratch, including the native library, so you're welcome to use that test case any way you like).
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2015-05-07 12:19:56 UTC
Setting status to "confirmed" as per comment 2.


## Additional detailed regression status: REGRESSION between XVS 3.9 and XVS 3.11

GOOD: XVS 3.9.547  (20fd2f0) + Xamarin.iOS 8.9.1.3    (f7736a4)
BAD:  XVS 3.11.445 (5061f92) + Xamarin.iOS 8.10.0.267 (6481535)
BAD:  XVS 3.11.507 (dfac85e) + Xamarin.iOS 8.10.1.24  (1b48440)
Comment 10 Naqeeb 2015-05-12 13:28:57 UTC
I have checked this issue with XVS 3.11.521 + XI 8.10.1.45 and now it build/run successfully without any error. 

Screencast: http://www.screencast.com/t/gvzyjfGC2nPk

Hence closing this issue.
Comment 11 Brendan Zagaeski (Xamarin Team, assistant) 2015-05-21 11:55:18 UTC
*** Bug 30262 has been marked as a duplicate of this bug. ***