15

I just started coding in C, and ran someone else's Makefile with the default C compiler set to gcc. I am on Mac OSX 10.8 Mountain Lion and I believe I installed the compiler with "XCode Command Line Tools." After running "make" on command line, I get these annoying .dSYM files for each program. I read that these are debug files, but are they really necessary? Is there any way to prevent them from being generated from command line?

pyrrhic
  • 1,769
  • 2
  • 15
  • 27
  • 1
    Check for `dsymutil` being run in the `Makefile` and comment it out. `gcc` on OS X should not be generating those on it's own. The tool that does it is called `dsymutil`. Also: No, they are not required to run the binary and are only for debugging purposes. – Sergey L. Jul 19 '13 at 10:36
  • There is no dsymutil in the Makefile but the following flags are run: CFLAGS = -m32 -g -O0 -std=gnu99 -Wall – pyrrhic Jul 19 '13 at 10:57

3 Answers3

34

The -g flag to GCC will generate debug symbols. You may simply remove that flag from CFLAGS.

Brendan Berg
  • 1,918
  • 2
  • 19
  • 22
14

Yes, the dSYM files are necessary. Specifically, they contain the symbol tables that are included within Xcode debug builds; release builds put the symbols in this separate file. If you ever need to analyze a stack trace from a release build you will need this. And make sure you don't lose the files, because doing the build again, even if the source is absolutely the same, won't produce a usable dSYM file. Each build is given a UUID and that changes with each build, even if the source has not changed. (I guess it includes a timestamp or even a random number.)

If you throw away the dSYM files, then if you suddenly find your app crashing a lot, you may be sorry.

wberry
  • 18,519
  • 8
  • 53
  • 85
0

They're only necessary if you need to interpret locations in stack traces within a crash report.

Paul Dardeau
  • 2,589
  • 1
  • 13
  • 10