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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement : Respect STRIP_STYLE project option #2485
Comments
|
You should be using |
|
Hey @blender, it shouldn't and doesn't. Because of two things:
But for
|
|
@dive, you’re probably aware, but just for context on the decision to set
The decision of what flags to include in But, I've just had the thought, what if we bridge that gap by writing an extended attribute for |
as to why |
|
Hey @jdhealy. Thanks for the excellent resume on the issue. Yeah, I'm aware of these conversations that's why I've raised this question again as an enhancement. I like the idea of Of course, we can try a brute force solution and embed a simple generated @blender, the problem is that we cannot add parameters to |
I would say we have have to make use that this property is preserved through zip/unzip/git and whatever other tools used in the process. While I'm ok with the solution I also think that it's the most risky.
I'm not 100% this is acceptable given carthage's philosophy, people will suddenly find a rogue file in their projects. However either this or a What is the drawback of just adding |
Yeah, there are several pros and cons for both solutions. But I prefer an obvious way either.
So, it's too dangerous to enable |
Not quite straight from the source, but extended attributes are not encoded into But, consider: users — if made aware that So, we could make users aware with output when If that seems too noisy, we could gate by certain calendar date after which it no longer gets output. Both the line about the change and also that hyperlink to a page outlining workarounds would, of course, be included in the release notes. |
Yeah, but at least it will not solve the issue with local pre-built binaries. For example, we build one of our frameworks with Carthage locally and store it within the repository. Right now we have a custom build script that applies our custom
It would be more informative if we will notify users about overridden build options by Carthage during the build phase as to me. I think we can implement an additional parameter for Carthage that will preserve all user-defined build options inside a framework and will use this information during Also a bit of philosophy :) As @blender mentioned above while discussing the brute force solution with simple embedded
But, from my point of view, the current behaviour contradicts the following postulate described in "Differences between Carthage and CocoaPods" because we override user-defined options explicitly and without any notice:
|
|
Ok, let me take one step back here
As far and I understand the only override Carthage is doing is
So, are we sure there is no way to get the dSYM generated here? @dive Can you try to archive the framework in question and check if it's stripped by Xcode as you expect and if the dSYM is generated? I have the suspicion that one of the two will not happen. I am open to anything but imho:
Technically we can also just generate another file that sits along side the frameworks in |
|
ping |
|
@blender, hey! Sorry for the delay but I have no time to check it right now. Maybe next week. At this stage, we decided to switch back to P.S. also I've noticed that Carthage ignores |
|
My background: I'm extremely new to Carthage and tried it a month ago but decided to use It was previously stated not stripping is necessary due to using archive in order to generate a full dsym.
I believe this is incorrect. If I'm misunderstanding something it would be helpful to get clarification. To test, I archived in Xcode and via command line, which I'll focus on. It did its thing, compiled, linked, CreateUniversalBinary.... Then GenerateDSYMFile, some stuff like copy, Touch the framework, Strip the framework, some finishing stuff, then Touch the dsym last. This results in a framework sized as expected (small) because symbols have been stripped out and a full dSYM, which can be used to desymbolicate. Therefore archive can be used with stripping and getting a full dsym. Note, the dsym is generated before stripping. My understanding of the reasoning for overridding settings is because of flags, so let's examine them. Strip Style has already been gone over so I won't paste it here, and based on Desire should be respected (I use -x).
None of these should affect the dsym generation when the dsym settings are correct. For transparency I've included my archive command to compare against Carthage. I can provide parts of logs or more info if requested but it has to be specific because I have to remove proprietary info. |
|
@sheehanm You're absolutely right, in my opinion. Using "archive" does not prevent dSYM generation. I'm the one who implemented the overriding of setting to facilitate dSYM generation in it's current form. When I did the implementation, I explicitly pointed out there were two directions we could go:
The response was that people wanted the library built by Carthage to always have symbols, regardless of the library's own build settings. So we went with #1. See #2280 (comment) I think you make a persuasive argument that we should have gone in the other direction, to be honest. Specifically, Carthage has always valued simplicity and avoided magic and we might be trending too far away from that here. I do think we really need to answer the fundamental question, which is, "do users expect the frameworks build by Carthage to be stripped of symbols, even if the author of that framework has explicitly enabled symbol stripping?" I think we can really only move forward if we answer that question. |
You can read yourself the motivation for the overrides. Carthage/Source/CarthageKit/Xcode.swift Lines 695 to 716 in 49c7901
I agree. So a potential fix to this would be to run https://github.com/Carthage/Carthage/blob/master/Source/CarthageKit/Xcode.swift#L588 only if BTW Almofire has
|
|
I just tried and I think we're on the right path here. I'll try to make a branch so that you guys can check. |
|
here is the branch: https://github.com/blender/Carthage/tree/fix/2485-respect-strip-style Don't rely on this in production because. It is not the final version and it would need some heavy reworking to make everything work as expected. some example issues:
|
|
Is this something that can help with reducing framework sizes ? We are having nearly 50 dependencies in our project and start of this month iPA size was 77 MB and end of this month it became 159 MB. We inspected iPA files and all this size is because of frameworks increased by 3 times in span of 6-7 test builds. And this increase is only for Carthage built frameworks. Any idea what could happen ? |
Yes
Not all symbols are stripped. If you have specified a different strip style other than -S (debug symbols) then you could be experiencing a binary size increase. Changes have happened over 3 versions of Carthage (0.28.0, 0.29.0 and 0.30.1). I don't know how often you build but I'm fairly certain binary size should be constant given a specific version of Carthage . For 0.30.1 try checking if your application target has "COPY_PHASE_STRIP" to Yes. Also you should be using |
|
We build almost everyday and it keeps on increasing the binary size with new builds since start of this month. Our app size doubled in 1 month just with this framework sizes and no idea what was wrong or what we had done different to cause this. We are on 0.30.1 version of Carthage. This is the strip options we use in our project. |
|
I think we're all on the same page here acknowledging that the more code is in your frameworks the bigger the size? That said, if the strip style of your frameworks is "All Symbols" carthage unfortunately does not respect that at the moment. It only strips debug symbols during So then, in your app set "Strip Debug Symbols During Copy" to yes. If that is not enough, you have to strip your frameworks manually for all symbols at the moment. |
|
@tmspzz Thanks for your work, I see your branch here has the basics to fix this. You mentioned that:
Specifically for this issue:
I believe is not a problem. Consumers can use What else do you think is needed? |
|
@acecilia I am afraid I don't recall, it's been 5 years now. The changes should be reevaluated in the light of .xcframeworks as well. |

which carthage:/usr/local/bin/carthagecarthage version:0.29.0xcodebuild -version:Xcode 9.4 Build version 9F1027a--no-build?: No--no-use-binaries?: No--use-submodules?: No--cache-builds?: No--new-resolver?: NoCartfile
Carthage Output
Actual outcome
Carthage did not respect
STRIP_STYLE = non-globaloption for the project during the build because of the following code:As a consequence, the
stripwithin Carthage is executed without-xoption and in some cases, we get a huge unexpected binary. Of course, we canstripit later with a properstripoptions, but it's an overhead (.dSYMbecomes useless, needs time to execute, etc.). Also, theseframeworkscannot be stripped properly within application target (for Release, etc.) because we do not have the information aboutSTRIP_STYLEsetting for each prebuiltframeworkat this point.Expected outcome
Carthage should(?) respect
STRIP_STYLEoption forframeworks, callstripwith proper options and skip.dSYMgeneration if necessary. From my point of view,.xcconfigitself (or project settings) must be the source of truth.At least, let's show a warning message or information note during the build if Carthage is going to ignore some inherited options.
The text was updated successfully, but these errors were encountered: