Search code examples
iosswiftxcodexcodebuild

Why unsigned xcarchive is larger than signed?


I use the following command to generate signed xcarchive:

xcodebuild -workspace app.xcworkspace -scheme app -configuration 'Release' -sdk iphoneos archive -archivePath build/signed.xcarchive

to build unsigned xcarchive I just append at the end:

CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO

And I'm curious why unsigned xcarchive has 332 MB and signed 222 MB?

I found out that for example libswiftCore.dylib in signed xcarchive has only 23.3 MB and in unsigned has 95.4 MB. Strange.

  • Xcode 10.2.1
  • Swift 4
  • Deployment target: 10.0
  • Using CocoaPods
  • Additional dependencies: Alamofire

Difference


Solution

  • After further investigation by comparing output of each build using opendiff I discovered that for signed build xcodebuild runs bitcode_strip on each dylib which significantly reduces size.

    That's why there is the difference in size between those two builds.

    To be more specific in case of unsigned build xcodebuild runs:

    builtin-swiftStdLibTool --copy --verbose ...

    and without parameter --sign it doesn't strip bitcode. Message from build output:

    Ignoring --strip-bitcode because --sign was not passed

    Therefore it seems to be an intended behaviour of xcodebuild.