Preserve user-passed CXXFLAGS with --enable-debug #6434

pull gavinandresen wants to merge 1 commits into bitcoin:master from gavinandresen:preserve_CXXFLAGS changing 1 files +3 −2
  1. gavinandresen commented at 1:22 PM on July 14, 2015: contributor

    I was surprised that this didn't work: ./configure --enable-debug CXXFLAGS="-DDEBUG_LOCKORDER" @theuni : I don't THINK this will have unintended consequences, is there a reason --enable-debug overwrote CFLAGS/CXXFLAGS?

  2. theuni commented at 5:07 PM on July 14, 2015: member

    @gavinandresen looks good to me, agreed that the behavior is unexpected. A few thoughts, though:

    • I believe it's that way because "-O2 -g" are already added by default. After this change, a ./configure --enable-debug will end up with duped flags I think. Not a problem really, the last flag wins.
    • You really want to be passing that in as CPPFLAGS=-DDEBUG_LOCKORDER anyway. Those are pre-processor flags, which exist separately so they don't get mixed up in arguments about optim flags and etc.
    • IMO There should be no need to pass -DDEBUG_LOCKORDER via a flag, that kinda defeats the purpose of having configure options to begin with. How about just adding -DDEBUG_LOCKORDER to CPPFLAGS in the --enable-debug case?
  3. gavinandresen commented at 9:45 PM on July 14, 2015: contributor

    RE: CPPFLAGS: hmm, then --enable-debug should add -DDEBUG to CPPFLAGS instead of CFLAGS/CXXFLAGS...

    RE: adding -DDEBUG_LOCKORDER to --enable-debug: sounds good to me.

  4. laanwj commented at 6:54 AM on July 15, 2015: member

    How about just adding -DDEBUG_LOCKORDER to CPPFLAGS in the --enable-debug case?

    Sounds good to me.

    Although maybe then it should be documented then that the flag doesn't just add debug information, but also enables specific debug functionality.

    Or maybe that's already clear:

    --enable-debug          use debug compiler flags and macros (default is no)
    
  5. laanwj added the label Build system on Jul 15, 2015
  6. configure --enable-debug changes
    Three changes to how configure --enable-debug behaves:
    
    1. Preserve user-passed CXXFLAGS/CFLAGS
    2. Compile with -DDEBUG_LOCKORDER
    3. Add -DDEBUG -DDEBUG_LOCKORDER to CPPFLAGS (since they are preprocessor options)
    83b48c8971
  7. gavinandresen force-pushed on Jul 15, 2015
  8. gavinandresen commented at 6:10 PM on July 15, 2015: contributor

    Tweaked based on comments:

    Three changes to how configure --enable-debug behaves:

    1. Preserve user-passed CXXFLAGS/CFLAGS
    2. Compile with -DDEBUG_LOCKORDER
    3. Add -DDEBUG -DDEBUG_LOCKORDER to CPPFLAGS (since they are preprocessor options)
  9. theuni commented at 6:40 PM on July 15, 2015: member

    Thanks, looks good.

  10. laanwj merged this on Jul 17, 2015
  11. laanwj closed this on Jul 17, 2015

  12. laanwj referenced this in commit 059b3525c4 on Jul 17, 2015
  13. luke-jr referenced this in commit 899c189df9 on Jan 9, 2016
  14. luke-jr referenced this in commit 4be978311d on Jan 10, 2016
  15. zkbot referenced this in commit df07f9ad23 on Feb 15, 2017
  16. zkbot referenced this in commit ec069ce96c on Mar 3, 2017
  17. zkbot referenced this in commit 702eefc71a on Mar 3, 2017
  18. zkbot referenced this in commit 99c4c6de0c on Mar 3, 2017
  19. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-01 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me