문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top