[Mesa-dev] last call for autotools

Dylan Baker dylan at pnwbakers.com
Wed Dec 19 18:29:36 UTC 2018


Quoting Nicolai Hähnle (2018-12-18 09:37:43)
> On 17.12.18 23:46, Dylan Baker wrote:
> > Quoting Marek Olšák (2018-12-17 12:25:29)
> >> On Mon, Dec 17, 2018 at 1:18 PM Eric Anholt <eric at anholt.net> wrote:
> >>
> >>      Eero Tamminen <eero.t.tamminen at intel.com> writes:
> >>
> >>      > Hi,
> >>      >
> >>      > On 17.12.2018 8.08, Marek Olšák wrote:
> >>      > [...]
> >>      >> I think one of the serious usability issues is that environment
> >>      >> variables such as CFLAGS, CXXFLAGS, LDFLAGS, and PKG_CONFIG_PATH are not
> >>      >> saved by meson for future reconfigures.
> >>      >
> >>      > I don't know what Meson is supposed to do, but to me that would be
> >>      > a bug in a build tool.
> >>      >
> >>      > Re-configure is supposed to adapt SW to the changes in the build
> >>      > environment, and environment variables are part of that (along with
> >>      > command line options and SW installed to to the system).  Build
> >>      > configure tool deciding to "remember" some of those things instead
> >>      > of checking the new situation, seems like a great opportunity for
> >>      > confusion.
> >>
> >>      A user-triggered reconfigure, sure.  Recapture env vars then.  But "git
> >>      pull; ninja -C build" losing track of the configuration state is broken.
> >>      We don't have to specify all of your meson -Doption=state configuration
> >>      on every build, why should you need to specify your PKG_CONFIG_PATH
> >>      configure options on every build?
> >>
> >>
> >> Thanks, Eric.
> >>
> >> Yes, meson behaves such that users have to set all environment variables for
> >> every "ninja" command that might reconfigure.
> >>
> >> I see 2 solutions:
> >> 1) meson needs to remember the relevant env vars
> >> 2) meson should FAIL to configure if any of the env vars are set (if it wants
> >> to ignore them)
> >>
> >> Marek
> > 
> > Meson does remember the *_FLAGS variables. Those are translated on configure
> > into meson's internal ${lang}_args and ${lang}_link args. It does look like
> > those aren't remembered when --wipe is called though, I filed a bug for that:
> > https://github.com/mesonbuild/meson/issues/4650
> 
> I ran into this same problem and noticed that Meson is already able to 
> *warn* about such changes.
> 
> It should either ignore the changes, or better yet, fail.
> 
> (Or even better: ignore environment variables entirely; IMO sourcing the 
> environment implicitly in a build system with an explicit configure is 
> just a broken design that was unfortunately inherited from plain make 
> without really considering the UI implications.)

I agree with this, as do most of the upstream meson developers. So do the
autotools developers, who recommend passing CFLAGS (and friends) as arguments
instead of as env variables:

./configure CFLAGS='-march=native -03' LDFLAGS='-O3' --enable-foo

meson supports this using:

meson -Dc_args='-march-native' -Dc_link_args='-O3' -Dfoo=true

Meson basically inherited this from autotools, and in hindsight we shouldn't
have.

I'm going to do 3 things I think:
- Update our documentation to strongly recommend -Dc_args and not CLFAGS
- Push for meson to warn about using environment variables and recommend command
  line options.
- Push for meson to remove CFLAGS and friends support:
  https://github.com/mesonbuild/meson/issues/4664

Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181219/55d4d812/attachment.sig>


More information about the mesa-dev mailing list