Bug 55256 - Add support for automatically remove bitcode from third-party libraries when needed
Summary: Add support for automatically remove bitcode from third-party libraries when ...
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: master
Hardware: PC Mac OS
: --- enhancement
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
: 55224 ()
Depends on:
Reported: 2017-04-17 10:01 UTC by Rolf Bjarne Kvinge [MSFT]
Modified: 2017-04-25 16:16 UTC (History)
2 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 or GitHub 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 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