views:

143

answers:

3

When I am building packages, (on Gentoo, but that's not too important to this question) I get this warning that '-ggdb3' flag can 'break packages.

I have yet to find an instance of when that is true. Although I once found some code which broke under different optimisation settings, that's different from including debugging symbols.

Could some provide an example of code which would compile without debugging symbols and not compile (or go wrong in some other way at runtime) with them?

+1  A: 

I have never had a single test fail (or much less, a package break) due to debugging symbols being included. I've only been bitten by optimization bugs when dealing with PPC.

However, you must consider what you are building. If the executable is going to be copied into something like an initrd, you generally want it either stripped (or compiled without debugging symbols), especially if statically linking.

Tim Post
What's ppc? You don't mean 'Pay Per Click' do you?
Chris Huang-Leaver
@Chris Huang-Leaver: http://refspecs.freestandards.org/LSB_1.3.0/PPC32/spec/book1.html (i.e. PowerPC .. something those clever folks at Motorola came up with) ?
Tim Post
@tinkertim IC, the only one I can think of is this http://stackoverflow.com/questions/768588/ which I think is a compiler issue with Solaris.
Chris Huang-Leaver
@Chris Huang-Leaver: Its hard to tell if CC is actually gcc, or how its invoked in that question. The question is linux centric, though I'm not casting out Solaris as a forgotten child. Solaris (but not so much OpenSolaris) has been problematic in quite a few corner cases.
Tim Post
A: 

Sometimes when you turn on debugging symbols, it actually changes the code that is generated by the compiler, in which case there is always the possibility of going from "correct code" to "incorrect code".

I don't know what specific changes "-ggdb3" enables, but perhaps this is what you are being warned about.

Michael Snyder
This is never the case for GCC, AFAIK
Hasturkun
+1  A: 

In the "old days" I built an entire Linux from Scratch system leaving debugging on for every single binary. Sure, the install was significantly larger, memory usage was less than ideal, but I never had any problems at all, either in compilation or subsequent execution.

It is hard to prove a negative, and one can't through anecdote, but a year of running this as a second desktop/toy server would lead me to conclude that it is really not a problem.

I think the flag you are getting is the standard warning that a package will give in Gentoo if you set USE flags with which it was not tested, or with which it is not really meant to be installed. As long as you know what the flag is---and in this case, you seem to---and you are not placing it in any "mission critical" setting (i.e., you will get blamed if something goes wrong) seems safe to ignore those warnings.

Woland
leaving -Werror in your CFLAGS does cause no end of hassle, but that's another story ;-)
Chris Huang-Leaver