adding debug variants?

Vincent Lefevre vincent-opdarw at
Sun Mar 11 13:41:16 PDT 2007

On 2007-03-11 10:14:39 -0700, Paul Beard wrote:
> All I had to do was add "-O0 -Wall -g" to the CFLAGS but for many users that 
> might not be something they're comfortable with. Add to that the additional 
> complication of the instructions reading "-O0 -g- Wall" (the difference a 
> space can make) and the resulting failures and it might prove frustrating.

IMHO, instead of a variant, MacPorts should allow users to specify
default compiler options (e.g., CFLAGS) since there are too many
possibilities. For instance, though -O0 is better for real debugging
purpose, it degrades performance, and in general, -O1 is fine for
normal use and still allows a significant core dump in case of crash.
Indeed the gcc man page says about the -g option:

   GCC allows you to use -g with -O.  The shortcuts taken by optimized
   code may occasionally produce surprising results: some variables
   you declared may not exist at all; flow of control may briefly move
   where you did not expect it; some statements may not be executed
   because they compute constant results or their values were already
   at hand; some statements may execute in different places because
   they were moved out of loops.

   Nevertheless it proves possible to debug optimized output.  This
   makes it reasonable to use the optimizer for programs that might
   have bugs.

Vincent Lefèvre <vincent at> - Web: <>
100% accessible validated (X)HTML - Blog: <>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)

More information about the macports-users mailing list