Xcode: "no debug symbols in executable" for repeated Release build with Deployment Postprocessing

1.2k Views Asked by At

The Problem

When I repeatedly build release in Xcode, the resulting dSYM is completely empty and so the debugger can't show anything.

I've been able to reproduce this with a minimal project as follows in Xcode 11.3.1:

  • File -> New Project (macOS, App, Objective-C)
  • in the target's Build Settings:
    • set the DEPLOYMENT_POSTPROCESSING for Release to YES
  • Product -> Scheme -> Edit Scheme
    • set Build Configuration to Release
  • Product -> Build
  • change a file that's not being compiled into the binary (e.g. change the Copyright notice in Info.plist
  • Product -> Build

Now there is a warning in the build log in the GenerateDSYMFile step

warning: no debug symbols in executable (-arch x86_64)

If the resulting app is run, there will be no debug information (you can't set a breakpoint in Xcode, if you break manually the stack frames will just be ___lldb_unnamed_symbol, ...)

What I found out so far

The relevant part of the Xcode build process seems to be:

  1. Linking the object files to form the binary (only if at least one of them has changed)
  2. Generate dSYM file from binary (if anything in the output has changed)
  3. Stripping the binary, i.e. removing debug symbols (if anything in the output has changed)

So 1) is skipped in the repeated build, because the sources (and thus the object files) have not changed. 2) is executed, because the Info.plist has changed, but it operates on the binary that has already been stripped by the previous build. Hence, the dSYM is empty.

It looks like 2) should only be rerun under the same conditions as 1), but these dependencies seem to be hard-wired in Xcode...

Is there any way around this problem?

0

There are 0 best solutions below