Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic frameworks should be stripped (STRIP_INSTALLED_PRODUCT) #10277

Open
1 task done
jrose-signal opened this issue Dec 11, 2020 · 2 comments
Open
1 task done

Dynamic frameworks should be stripped (STRIP_INSTALLED_PRODUCT) #10277

jrose-signal opened this issue Dec 11, 2020 · 2 comments

Comments

@jrose-signal
Copy link

Report

A very old change, #1217, turned off the STRIP_INSTALLED_PRODUCT build setting to ensure that internal symbols from static libraries properly end up in the dSYMs created by the Archive action. However, this doesn't make sense for dynamic libraries, which have separate dSYMs from the resulting app. Not stripping internal symbols can result in a huge increase in binary size for Swift, which has long symbol names and many internal symbols. (Objective-C tends to produce public and static symbols but not internal (visibility(hidden)) in default Xcode configurations.)

For a concrete example, a release arm64 build of SignalServiceKit is 27MB by default, and 18MB after stripping. 馃槶

#1217 also mentions that only the project-level setting is respected, not per-target settings. That was probably true in the past, but is no longer true in Xcode 12.1. I don't know when this changed, but it does mean the default behavior can be kept as is while turning stripping back on at the per-target level if the build product is a dynamic framework. (CocoaPods doesn't support non-vendored dynamic library pods, right?)

CocoaPods Environment

Stack

   CocoaPods : 1.9.3
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
    RubyGems : 3.0.3
        Host : Mac OS X 10.15.7 (19H15)
       Xcode : 12.2 (12B45b)
         Git : git version 2.24.3 (Apple Git-128)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Installation Source

Executable Path: /usr/local/Cellar/cocoapods/1.9.3/libexec/bin/pod

Plugins

cocoapods-binary      : 0.4.4
cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.5.0
cocoapods-try         : 1.2.0

Podfile

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'PodTest' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for PodTest
  pod "AFNetworking"
end
@JoeSzymanski
Copy link

Has anyone found a good solution for this? We are hitting a similar issue around binary size for dynamic frameworks. However, when I explicitly change the stripping settings via the main app's Podfile (enabling "COPY_PHASE_STRIP" and "STRIP_INSTALLED_PRODUCT"), I run into the problem that the Swift symbols are mangled, so debugging becomes significantly harder.

zacwest added a commit to home-assistant/iOS that referenced this issue Oct 20, 2022
## Summary
Cocoapods does not strip the .frameworks it creates, which was done for
us automatically when we were submitting using Bitcode, but upgrading to
Xcode 14 means that no longer happens for us.

## Any other notes
I think the tides are shifting strongly towards moving back to SPM,
which hopefully (lol) would be less buggy than the last time we tried
it.

Outstanding Cocoapods issue for this one:
CocoaPods/CocoaPods#10277
@mgrms
Copy link

mgrms commented Jan 13, 2023

Same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants