[Mesa-dev] Meson's default build type

Eric Engestrom eric.engestrom at imgtec.com
Mon Nov 6 17:14:14 UTC 2017


On Monday, 2017-11-06 08:07:21 -0800, Chad Versace wrote:
> On Thu 02 Nov 2017, Dylan Baker wrote:
> > Quoting Matt Turner (2017-11-02 10:06:43)
> > > On Thu, Nov 2, 2017 at 9:51 AM, Michel Dänzer <michel at daenzer.net> wrote:
> > > > FWIW, my vote is for debugoptimized: Assertions are enabled and there's
> > > > debugging information useful for bug reports, but performance should be
> > > > decent.
> > > 
> > > If debugoptimized turns on DEBUG, then I don't think performance will
> > > be decent as that enables paths like nir_validate. Maybe we should
> > > change debugoptimized to not do that. Not sure.
> > > 
> > > I think some of the messaging got confused -- autotools does specify
> > > -g in the default CFLAGS, but that doesn't really mean it's a useful
> > > debug build. -g -O2 is really a release build, with debugging symbols.
> > 
> > debugoptimized does turn on DEBUG. Last time I tried (which was a while ago),
> > if asserts are enabled but DEBUG is not mesa couldn't be compiled, as asserts
> > used members of structs that only exist when DEBUG is set. Maybe that's a
> > situation that deserves being revisited.
> 
> I vote for debugoptimized, where debuoptimized contains CFLAGS='-g -O2'.

This is already the default behaviour on meson [1]

[1] http://mesonbuild.com/Running-Meson.html#configuring-the-source

> The user gets a build that's suitable for everyday use (-O2) and it the
> user can submit meaningful bug reports (-g).
> 
> To -DDEBUG or not to -DDEBUG... Since I want to ensure that users with
> a self-built Mesa have a Mesa that's suitable for everyday use, I think
> the default build should *not* contain assertions that severely impact
> performance. So I vote against -DDEBUG; or, at a minimum, we could keep
> -DDEBUG and somehow disable the slooooooow assertions in debugoptimized.

assert()s are controlled by the standard NDEBUG, which is not tied to
Mesa's DEBUG.

Mesa's autotools, having only two build types, locally defines NDEBUG
when --enable-debug is not given, kind of tying the two together.
Meson on the other hand uses the build option `b_ndebug` to control
NDEBUG, which defaults to `false` (ie. "don't compile out asserts").

Mesa's DEBUG is currently enabled in Meson on both `debug` and
`debugoptimized` builds. We could limit it to `debug` only, removing
DEBUG code in `debugoptimized` but keeping assert()s.

Does that sound like a good middle-ground?


More information about the mesa-dev mailing list