Build: ./configure --enable-debug generates -O2 optimization option which overrides earlier -Og. #13432

issue murrayn opened this issue on June 11, 2018
  1. murrayn commented at 8:17 AM on June 11, 2018: contributor

    ./configure --enable-debug generates -O2 gcc option, overriding earlier -Og option which is the correct optimization level for -g debugging.

    CFLAGS = -g -O2 [...] CXXFLAGS = -Og -g3 -Wstack-protector -fstack-protector-all -Wall -Wextra -Wformat -Wvla -Wformat-security -Wno-unused-parameter -g -O2

    Ubuntu 16 and OSX 10.13

  2. fanquake added the label Build system on Jun 11, 2018
  3. ken2812221 commented at 9:12 AM on June 11, 2018: contributor

    You can use --disable-maintainer-mode to disable those flags.

  4. kallewoof commented at 9:49 AM on June 11, 2018: member

    Shouldn't --enable-debug automatically do --disable-maintainer-mode in that case? Currently --enable-debug is useless at least on macs, as it still generates optimized code so lldb barfs.

  5. murrayn commented at 11:40 AM on June 11, 2018: contributor

    @ken2812221 Why did you close your PR #13434? At first glance it looked good to me.

  6. ken2812221 commented at 11:59 AM on June 11, 2018: contributor

    You can still use ./configure --enable-debug --disable-maintainer-mode to do what you want, so I don't think this is a bug.

  7. luke-jr commented at 2:47 PM on June 11, 2018: member

    @kallewoof IF --disable-maintainer-mode has any effect here, it is accidental, not the purpose of the flag. It shouldn't. -g -O2 should be the default CFLAGS (without --enable-debug) with or without maintainer mode.

  8. kallewoof commented at 7:27 AM on June 12, 2018: member

    @luke-jr Right. Currently, -g -O2 are the C*FLAGS even if you do --enable-debug, which results in optimized binaries that cannot be reliably debugged using lldb on macs. I was not able to use lldb until I realized I had to manually edit the makefile to replace -g -O2 with -g in order to get debuggable binaries.

  9. laanwj closed this on Jun 13, 2018

  10. laanwj referenced this in commit 8eb76f3958 on Jun 13, 2018
  11. UdjinM6 referenced this in commit 60ef78b626 on Jun 20, 2021
  12. UdjinM6 referenced this in commit 76023bcf2d on Jun 24, 2021
  13. UdjinM6 referenced this in commit 0545f4c2a3 on Jun 26, 2021
  14. UdjinM6 referenced this in commit 1ec8e290de on Jun 26, 2021
  15. UdjinM6 referenced this in commit 12a261293f on Jun 26, 2021
  16. PastaPastaPasta referenced this in commit f0d66d23da on Jun 27, 2021
  17. PastaPastaPasta referenced this in commit 09b7853234 on Jun 28, 2021
  18. PastaPastaPasta referenced this in commit be20a12a1e on Jun 28, 2021
  19. UdjinM6 referenced this in commit 2615ebca43 on Jun 28, 2021
  20. PastaPastaPasta referenced this in commit 15425bc537 on Jun 29, 2021
  21. MarcoFalke 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-04-20 12:15 UTC

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