Hi everyone,

I posted some questions on the chat wondering why most Linux distros include -g in the -Doptimize option when building their included system Perl distribution. For example:

sh Configure -des -Doptimize='-O2 -g ...'

Some people on this site said there are advantages to having -g in ccflags which adds system debugger support and -g has very little if any performance overhead unlike -DDEBUGGING which will build full internal support for debugging Perl and this has a significant performance hit.

The Install docs say, by adding -g to -Doptimize this will only enable support for the system debugger and will not add Perl internal debugging support by making sure -DDEBUGGING in not in the ccflags. Though if you try to build Perl with -g in -Doptimize as instructed it doesn't do what you think and also adds Perl internal debugging support by adding -DDEBUGGING in ccflags and this will make your Perl binary much slower.

If you use the second synonym option from the docs and must remove the -g from -Doptimize and added a separate -DEBUGGING=-g configure option then it does the right thing, it only adds -g to the ccflags and doesn't add -DDEBUGGING. It could be that the install docs are not syntactically incorrect, maybe you must put -Doptimize='-g ...' first or something but that is confusing and possibly misleading.

I took a look at Perl 5.8.8 on RHEL and with 5.8.8 the Install docs behaviour seems to hold, they built it with -Doptimize='-O2 -g ...' and it doesn't build Perl with -DDEBUGGING. Then I tested Perl 5.10.1 and 5.12.3 where the Install docs behaviour is wrong just like I described, something changed between 5.8.8 and the newer versions and if you follow the docs it doesn't do what you want.


In reply to Perl Install docs "Building a Debugging Perl" section could have a mistake that builds wrong debugging Perl by hermida

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.