[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PROPOSAL] changing policy on compiling with -g .. a better way



Hi,

        Umm, since the intent is not to make the old way of doing
 things incorrect, we can do one of two things. Here are psuedo
 patches that detail the approaches. (I personally prefer the second
 approach). 

        First, the minimal change::
======================================================================
          CC = gcc
          CFLAGS = -O2 -g -Wall # sane warning options vary between programs
          LDFLAGS = # none
          install -s # (or use strip on the files in debian/tmp)
...

	  The `-g' flag is useful on compilation so that you have available a
	  full set of debugging symbols in your built source tree, in case
	  anyone should file a bug report involving (for example) a core dump.
+         Alternately, you could use an environment variable
+         BUILD_DEBUG, which, if set to `yes', would cause compilation
+         to be done with -g. The resulting binaries in your built
+         source tree will then contain the full set of debugging
+         symbols. You can also provide a target `build-debug' in
+         debian/rules which has the same effect as setting
+         BUILD_DEBUG to `yes'. This can be done quite simply, with
+         the folowing lines:
+ build-debug: BUILD_DEBUG=yes
+ build-debug: build
======================================================================

        The second way: we don't just offer an alternative, we
 deprecate the old method, but let it be still legal.
======================================================================
          CC = gcc
-         CFLAGS = -O2 -g -Wall # sane warning options vary between programs
+         # sane warning options vary between programs
+         ifeq (,$(findstring $(BUILD_DEBUG),YES yes Yes))
+         CFLAGS = -O2 -g -Wall 
+         else
+         CFLAGS = -O2 -Wall 
+         endif
          LDFLAGS = # none
-          install -s # (or use strip on the files in debian/tmp)
...

          
	  The `-g' flag is useful on compilation so that you have available a
	  full set of debugging symbols in your built source tree, in case
	  anyone should file a bug report involving (for example) a core dump.
+         It is acceptable, but deprecated, to always have -g in
+         ``CFLAGS'', and ``use install -s'' to install binaries or use
+         ``strip'' on the binaries in debian/tmp, but that make it
+         hard to create a debuggable debian package, and increase
+         build time for all builds, since debugging information is
+         created and then stripped away. The preferred method is to
+         use an environment variable BUILD_DEBUG, which, if set to
+         `yes', would cause compilation to be done with -g. The
+         resulting binaries in your package will then contain the full
+         set of debugging symbols. You can also provide a target
+         `build-debug' in debian/rules which has the same effect as
+         setting BUILD_DEBUG to `yes'. This can be done quite simply,
+         with the folowing lines:
+ build-debug: BUILD_DEBUG=yes
+ build-debug: build
======================================================================

        manoj
-- 
 Overall, the philosophy is to attack the availability problem from
 two complementary directions: to reduce the number of software errors
 through rigorous testing of running systems, and to reduce the effect
 of the remaining errors by providing for recovery from them.  An
 interesting footnote to this design is that now a system failure can
 usually be considered to be the result of two program errors: the
 first, in the program that started the problem; the second, in the
 recovery routine that could not protect the system. A.L. Scherr,
 "Functional Structure of IBM Virtual Storage Operating Systems, Part
 II: OS/VS-2 Concepts and Philosophies," IBM Systems Journal, Vol. 12,
 No. 4.
Manoj Srivastava   <srivasta@debian.org>  <http://www.debian.org/%7Esrivasta/>
Key C7261095 fingerprint = CB D9 F4 12 68 07 E4 05  CC 2D 27 12 1D F5 E8 6E


Reply to: