Bug 55256

Summary: Add support for automatically remove bitcode from third-party libraries when needed
Product: iOS Reporter: Rolf Bjarne Kvinge [MSFT] <rolf>
Component: ToolsAssignee: Bugzilla <bugzilla>
Severity: enhancement CC: mono-bugs+monotouch, v-gredav
Priority: ---    
Version: master   
Target Milestone: Future Cycle (TBD)   
Hardware: PC   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:

Description Rolf Bjarne Kvinge [MSFT] 2017-04-17 10:01:14 UTC
Reference: bug #55224.

Third-party libraries can be built with bitcode, but we don't support bitcode for iOS, which means the resulting executable might end up with incomplete bitcode when everything is linked together.

The App Store detects (and rejects) such binaries, but there's a workaround (copied from bug #55224 since that bug is private):

## Workaround / fix

Add the following lines to the iOS app project .csproj file immediately before the closing `</Project>` tag:

<Target Name="BeforeCodesign">
  <Exec Command="$(_SdkDevPath)\Toolchains\XcodeDefault.xctoolchain\usr\bin\bitcode_strip -r %(_Frameworks.FullPath) -o %(_Frameworks.FullPath)" />

(As a caution, as currently written this isn't optimized for minimizing incremental build times because it doesn't include `Inputs` and `Outputs` attributes.  One decent option might be to add a `Conditional` attribute so it only runs for the AppStore configuration to avoid adding extra time to incremental Debug builds.)

Xcode automatically calls bitcode_strip when bitcode is disabled, maybe we should look into doing something similar.

However as this is something that can be worked around, by both the app developer and the component developer, it's not a high priority.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2017-04-17 10:02:13 UTC
*** Bug 55224 has been marked as a duplicate of this bug. ***
Comment 2 Rolf Bjarne Kvinge [MSFT] 2017-04-25 14:10:10 UTC
master: https://github.com/xamarin/xamarin-macios/pull/2037