Xcode 8.3 produces binaries 3x larger than Xcode 8.2 due to a 4x increase in bitcode

Originator:jp
Number:rdar://31302382 Date Originated:28-Mar-2017 11:22 AM
Status:Closed Resolved:
Product:Developer Tools Product Version:Xcode 8.3 (8E162)
Classification:Other Bug Reproducible:Always
 
Summary:
The Realm Objective-C iOS framework compiled with Xcode 8.2 weighs in at 55MB with all architecture slices and bitcode included.

The same codebase compiled with Xcode 8.3 produces a binary about three times larger at 158MB, including 70MB for bitcode alone.

Steps to Reproduce:

With Xcode 8.2.1 and 8.3 installed:

1. git clone https://github.com/realm/realm-cocoa.git
2. cd realm-cocoa
3. git checkout v2.4.4
4. git submodule update --init --recursive
5. REALM_XCODE_VERSION=8.2.1 ./build.sh ios-dynamic
6. mv build/ios/Realm.framework Realm_Xcode821.framework
7. REALM_XCODE_VERSION=8.3 ./build.sh ios-dynamic
8. mv build/ios/Realm.framework Realm_Xcode83.framework

Compare Realm_Xcode821.framework with Realm_Xcode83.framework. For example:

1. size Realm_Xcode821.framework/Realm
55M Realm_Xcode821.framework/Realm
2. size Realm_Xcode83.framework/Realm
158M  Realm_Xcode83.framework/Realm

And:

1. otool -l -arch arm64 Realm_Xcode821.framework/Realm > Realm_Xcode821_otool_arm64.txt
2. otool -l -arch arm64 Realm_Xcode83.framework/Realm > Realm_Xcode83_otool_arm64.txt
3. git diff --no-index Realm_Xcode821_otool_arm64.txt Realm_Xcode83_otool_arm64.txt

which indicates that the __LLVM (bitcode) slice grew from 15MB to 67MB.

And:

1. otool -l Realm_Xcode821.framework/Realm > Realm_Xcode821_otool.txt
2. otool -l Realm_Xcode83.framework/Realm > Realm_Xcode83_otool.txt
3. git diff --no-index Realm_Xcode821_otool.txt Realm_Xcode83_otool.txt

Although there's not much difference in the outputs for that one.

Expected Results:
Compiling with Xcode 8.3 should produce binaries of similar size as with Xcode 8.2.

Actual Results:
Compiling with Xcode 8.3 produces binaries approximately three times as large as with Xcode 8.2.

Regression:
Describe circumstances where the problem occurs or does not occur, such as software versions and/or hardware configurations.

Notes:
See https://github.com/realm/realm-cocoa/issues/4785

Duplicates

Number Status Originator Product Title
rdar://31320085 Duplicate/31302382 dloewenherz Developer Tools Xcode 8.3 produces binaries 3x larger than Xcode 8.2 due to a 4x increase in bitcode

Comments

Comment from myself on April 4 2017

Thank you for fixing this so quickly! This issue has been resolved as of Xcode 8.3.1. The Realm.framework fat binary for iOS is now 56 MB, which is close enough to Xcode 8.2.1's 55 MB we measured before.

Comment from Apple Developer Relations on April 4 2017

Please verify this issue with the Xcode 8.3.1 GM and update your bug report at https://bugreport.apple.com/ with your results.

Xcode 8.3.1 GM (8E1000a) https://developer.apple.com/download/ Posted Date: April 6th, 2017

What about release builds?

It is not mentioned about release builds. Are release builds (*.IPA) affected as well?

By Ramunas.Jurgilas at March 30, 2017, 6:23 a.m. (reply...)

File attachments

https://gist.github.com/jpsim/c43fecb3934eb036340063c346b6a8c7


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!