Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-3784

LP:576468 - Problem building --with-debug

    Details

    • Type: Task
    • Status: Closed
    • Priority: Minor
    • Resolution: Not a Bug
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      I configured MariaDB with --with-debug=full, but I still get it building with "-O2", for example:

      gcc -DHAVE_CONFIG_H -I. -I../include -I../include -I../include -g -g -O2 -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -MT strxmov.o -MD -MP -MF .deps/strxmov.Tpo -c -o strxmov.o strxmov.c

      It looks like AC_PROG_LIBTOOL sets:

      CFLAGS = -g -O2
      CXXFLAGS = -g -O2

      This is the same with autoconf 2.63 on Mac and autoconf 2.59 on Linux.

      MySQL 5.1.46 configure has the same problem.

      Here is a quick patch which fixes the problem:

      === modified file 'configure.in'
      — configure.in 2010-04-29 07:29:04 +0000
      +++ configure.in 2010-05-06 15:41:15 +0000
      @@ -15,6 +15,12 @@

      1. first part and a 100 character second part.
        AM_INIT_AUTOMAKE([1.9 tar-ustar])
        AC_PROG_LIBTOOL
        +if test "$CFLAGS" = "-g -O2" ; then
        + CFLAGS=""
        +fi
        +if test "$CXXFLAGS" = "-g -O2" ; then
        + CXXFLAGS=""
        +fi

      AM_CONFIG_HEADER([include/config.h])

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            monty Michael Widenius added a comment -

            [Bug 576468] [NEW] Problem building --with-debug

            Hi!

            >>>>> "Paul" == Paul McCullagh <paul.mccullagh@primebase.org> writes:

            Paul> Public bug reported:
            Paul> I configured MariaDB with --with-debug=full, but I still get it building
            Paul> with "-O2", for example:

            Paul> gcc -DHAVE_CONFIG_H -I. -I../include -I../include -I../include -g -g
            Paul> -O2 -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE
            Paul> -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT
            Paul> -DDONT_DECLARE_CXA_PURE_VIRTUAL -MT strxmov.o -MD -MP -MF
            Paul> .deps/strxmov.Tpo -c -o strxmov.o strxmov.c

            Paul> It looks like AC_PROG_LIBTOOL sets:

            Paul> CFLAGS = -g -O2
            Paul> CXXFLAGS = -g -O2

            Paul> This is the same with autoconf 2.63 on Mac and autoconf 2.59 on Linux.

            Paul> MySQL 5.1.46 configure has the same problem.

            Paul> Here is a quick patch which fixes the problem:

            I usually don't mind the -O2 (except sometimes in the debugger) as
            this makes the code act in more similar ways as it will for the
            final user. (Some strange bugs are more likely to appear in optimized
            code).

            What I do when I don't want the -O2 is :

            CFLAGS="" CXXFLAGS="" ./configure --with-debug=full

            I tested this and with this I didn't get -O2 in my Makefiles

            Regards,
            Monty

            Show
            monty Michael Widenius added a comment - [Bug 576468] [NEW] Problem building --with-debug Hi! >>>>> "Paul" == Paul McCullagh <paul.mccullagh@primebase.org> writes: Paul> Public bug reported: Paul> I configured MariaDB with --with-debug=full, but I still get it building Paul> with "-O2", for example: Paul> gcc -DHAVE_CONFIG_H -I. -I../include -I../include -I../include -g -g Paul> -O2 -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE Paul> -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT Paul> -DDONT_DECLARE_CXA_PURE_VIRTUAL -MT strxmov.o -MD -MP -MF Paul> .deps/strxmov.Tpo -c -o strxmov.o strxmov.c Paul> It looks like AC_PROG_LIBTOOL sets: Paul> CFLAGS = -g -O2 Paul> CXXFLAGS = -g -O2 Paul> This is the same with autoconf 2.63 on Mac and autoconf 2.59 on Linux. Paul> MySQL 5.1.46 configure has the same problem. Paul> Here is a quick patch which fixes the problem: I usually don't mind the -O2 (except sometimes in the debugger) as this makes the code act in more similar ways as it will for the final user. (Some strange bugs are more likely to appear in optimized code). What I do when I don't want the -O2 is : CFLAGS="" CXXFLAGS="" ./configure --with-debug=full I tested this and with this I didn't get -O2 in my Makefiles Regards, Monty
            Hide
            paulmccullagh Paul McCullagh added a comment -

            Re: Problem building --with-debug
            Thanks Monty, setting CFLAGS and CXXFLAGS to "" in the environment works for me too.

            But I guess I am now missing a configuration option that specifically turns optimizations off. The problem is (as you mentioned) when working in the debugger.

            With -O2 local variables are often not available in the debugger.

            So it may be convenient to have an option like, for example, --without-optimization. Default will be enabled, of course.

            Show
            paulmccullagh Paul McCullagh added a comment - Re: Problem building --with-debug Thanks Monty, setting CFLAGS and CXXFLAGS to "" in the environment works for me too. But I guess I am now missing a configuration option that specifically turns optimizations off. The problem is (as you mentioned) when working in the debugger. With -O2 local variables are often not available in the debugger. So it may be convenient to have an option like, for example, --without-optimization. Default will be enabled, of course.
            Hide
            paulmccullagh Paul McCullagh added a comment -

            Re: Problem building --with-debug
            This is not a bug. But I changing this to a feature request because I think it would be convenient to have a configure option that specifically turns off optimization for debug and development purposes.

            Show
            paulmccullagh Paul McCullagh added a comment - Re: Problem building --with-debug This is not a bug. But I changing this to a feature request because I think it would be convenient to have a configure option that specifically turns off optimization for debug and development purposes.
            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 576468

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 576468

              People

              • Assignee:
                Unassigned
                Reporter:
                paulmccullagh Paul McCullagh
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: