3
votes

I can't get the "strip debug symbols during copy" option in XCode to work how I think it should work. The docs say:

"Activating this setting causes binary files which are copied during the build (e.g. in a Copy Bundle Resources or Copy Files build phase) to be stripped of debugging symbols."

However, what appears to happen in practice is that stripping is only performing on the linked binary after the copy happens, so the copied file is never stripped. e.g.: build log reads something like:

Compile main.c...
Link /Users/snowcrash/proj/blah/build/Release/foo.dylib
Copy bar/foo.dylib
Strip build/Release/foo.dylib

According to nm bar/foo.dylib still has debug symbols in it, as you'd expect since foo.dylib was copied before stripping. I have tried various combinations of settings (below) but can't make the strip happen before the copy.

Any idea how to make the copied file be stripped? Or maybe I've just misunderstood what it is meant to do!

Other relevant settings:

  • Deployment Postprocessing - Yes (required or other settings are ignored)
  • Strip Debug Symbols During Copy - Yes
  • Strip Linked Product - Yes (strips the build/Release/foo.dylib product)
  • Use Separate Strip - Yes (invokes strip with additional strip flags below, does not strip copied file)
  • Additional Strip Flags - '-x'

If the Strip Debug Symbols During Copy just doesn't work, I will try and use a post-build script and invoke strip myself.

1

1 Answers

0
votes

Since the XCode strip options do not behave as expected, I have turned them all off and added a Run Script build phase which does this:

if [ $CONFIGURATION = 'Stripped' ]
then
    strip -x -S $PRODUCT_NAME.dylib;
fi