Xcode LLVM+GCC 4.2 - Generate Debug Symbols
Asked Answered
A

1

8

I'm having a library project, I've always had "Strip Debug Symbols" turned ON for release builds

I recently noticed the "Generate Debug Symbols" flag. When I set "Generate Debug Symbols" flag to NO then my library size shrinks by 30%

Is this a reasonable optimization to make for release builds?

What is the difference between "Strip Debug Symbols" and "Generate Debug Symbols" option, ideally if I strip debug symbols won't all the generated debug symbols go away? Why am I seeing this difference?

Also what other optimizations other than -Os (Fastest, Smallest) I can make to reduce the binary size?

How does "Strip Linked Product" works?

Antebi answered 12/7, 2012 at 21:51 Comment(2)
I got a pretty good understanding from this link but I would still love some one to explain this.. developer.apple.com/library/mac/#documentation/DeveloperTools/…Antebi
I don't have definite answer but this link might be helpful - help.apple.com/xcode/mac/8.2/index.html?localePath=en.lproj#/…Arc
D
1

Concerning the reduction of the binary file size, this is how my release configuration file looks like concerning the stripping of the binary and I guess that's how most developers do it:

DEPLOYMENT_POSTPROCESSING = YES
COPY_PHASE_STRIP = NO (not necessary since my copied binaries are already stripped and codesigned)
STRIP_INSTALLED_PRODUCT = YES
STRIP_STYLE = all
SEPARATE_STRIP = YES
DEAD_CODE_STRIPPING = YES
GCC_GENERATE_DEBUGGING_SYMBOLS = NO

With these build settings, Xcode seems to be doing the same as running "strip" manually on the binary, at least from what the file size says.

I haven't found any other way to reduce the binary size even more yet. Note the "DEPLOYMENT_POSTPROCESSING" flag there - the binary size will be a lot bigger without it and for example all C functions will not be stripped.

Disrupt answered 7/5, 2014 at 22:21 Comment(1)
Does not fully answer the question. What is the difference between "Strip Debug Symbols" and "Generate Debug Symbols"? From their names, they sound like they contradict each other. Typical Xcode nonsense imo.Hygroscopic

© 2022 - 2024 — McMap. All rights reserved.