[Buildroot] [PATCHv4 02/16] core: enable 'NDEBUG' unless BR2_ENABLE_RUNTIME_DEBUG is set
Thomas De Schampheleire
patrickdepinguin at gmail.com
Sat Jun 5 17:11:17 UTC 2021
On Sat, Jun 5, 2021, 18:50 D. Olsson <hi at senzilla.io> wrote:
> Hi Thomas, Yann, all,
> > On 2021-06-01 16:34 +0200, Thomas De Schampheleire spake thusly:
> > +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),)
> > +TARGET_DEBUGGING += -DNDEBUG
> This broke bitcoin builds. I haven't looked deeply into the
> details, but it is my understanding that NDEBUG changes the
> behaviour of assert() in a way that Bitcoin explicitly does
> not support.
> I don't know if there is a workaround for this, but I have a
> feeling that passing NDEBUG for all packages might not be a
> good idea?
NDEBUG is a macro that, when set, will neutralize assert statements (see
man assert). The rationale is that assert statements can help developers
validate assumptions in a test phase, but that this code is better disabled
in release builds, for reasons of performance. At that time, the code is
expected to be correct.
It's odd but not unacceptable that bitcoin expects NDEBUG not to be set.
The workaround/solution would be to explicitly undefine NDEBUG, via
-UNDEBUG. This should become part of the flags set in bitcoin.mk on
It is possible that there are other packages that need this change, but
generally one wpuld expect projects to allow both scenarios.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the buildroot