This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 45240 - Native linking error with binding project when Entitlements are used
Summary: Native linking error with binding project when Entitlements are used
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: MSBuild (show other bugs)
Version: XI 10.0 (iOS10)
Hardware: PC Windows
: Normal normal
Target Milestone: (C9)
Assignee: Jeffrey Stedfast
URL:
Depends on:
Blocks:
 
Reported: 2016-10-10 14:29 UTC by John Miller (Xamarin Support)
Modified: 2017-02-21 21:20 UTC (History)
7 users (show)

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


Attachments

Description John Miller (Xamarin Support) 2016-10-10 14:29:50 UTC
**Overview**:

Attached are two build logs from the same solution. The only difference is supposed to be the use of an Entitlements file in the iOS project. It's unclear why the project produces native linking errors with a referenced binding project after adding an Entitlements file. 

**Actual Results**:

In the log that uses the Entitlements file, I see lots of errors like:

 Undefined symbols for architecture i386: (TaskId:512)
1    "std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t>

**Expected Results**:

No errors. However, it does seem there could be an issue with the bombgar reference not being built for i386. I am just not sure why it's only surfacing when using Entitlements. 

**Build Date & Platform**:

XVS 4.2.0.703
XI 10.0.1.8
Comment 2 Sebastien Pouliot 2016-10-12 14:23:33 UTC
The Entitlements.xcent is given to the (native) linker thru mtouch's `--gcc_flags` but they are not merged into a single argument, e.g.

--gcc_flags=-stdlib=libstdc++ -v -v -v -v --gcc_flags "-Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/dougstephens/Library/Caches/Xamarin/mtbs/builds/Cortana.Container.MT/de95adc32953f62af35a8d808ab53983/obj/iPhoneSimulator/Debug/Entitlements.xcent"

So the call to `clang` only has the last one (the entitlement bits) and miss the customer's linker flags which specify the C++ library to be used. That result in the native linker error.
Comment 3 Jeffrey Stedfast 2016-10-12 18:34:22 UTC
Simple fix:

Change your Mtouch Extra Arguments value from "--gcc_flags=-stdlib=libstdc++ -v -v -v -v" to "--gcc_flags -stdlib=libstdc++ -v -v -v -v" and things will work.

(i.e. the current MSBuild logic does not handle "--gcc_flags=....", it only works if you do not use the '='.
Comment 4 Jeffrey Stedfast 2016-10-12 18:51:58 UTC
https://github.com/xamarin/xamarin-macios/pull/982
Comment 8 Shruti 2017-02-07 06:11:02 UTC
@Jeffrey , It would be great help if you have a look to comment6 and respond with your inputs.
Comment 9 GouriKumari 2017-02-21 21:20:13 UTC
Verified this issue with an iOS project referring to a  bindings project and I couldn't reproduce this issue, hence I am marking this issue as verified fixed. 

##Logs:
Build Log: https://gist.github.com/GouriKumari/0b56c64b42a10bbb402a22ee809147d4

## Test Env:
https://gist.github.com/GouriKumari/656b3eec66c1543d4a703c461b61b529

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