Meson: Changing cross file content then calling ninja triggers configure but don't update c_args

Created on 17 Sep 2020  路  7Comments  路  Source: mesonbuild/meson

Describe the bug
Calling ninja after editing a cross file seems to reconfigure project but if something like c_args was changed meson doesn't see it.

To Reproduce

  • configure a project with cross compilation and c_args set if it has C sources for example
  • build it with ninja
  • then edit cross file to change for example c_args
  • call ninja again

Expected behavior
Should rebuild C sources with new flags.

system parameters

  • Fedora 32
  • python 3.8
  • meson from master (but should be the same with 0.55.X at least)
  • ninja 1.10.1
cross machine files

All 7 comments

I think the bug is actually in the other direction than you think. I think the desired behavior is that machine files are read only at meson setup and never again without meson setup --wipe, so we shouldn't reconfigure on machine file changes. I think you need to wipe the build directory to make the changes be noticed.

And to be clear, there's a really good reason for this. We basically read in the machine files, then apply the command line on top of it. Without serious refactoring (again) there isn't any way short of wiping for us to not clobber options set on the command line with those from the machine file.

@dcbaker , in this case ninja must ignore changes in cross(maybe machine?) files and not trigger an "half configuration" which is really misleading.

It's the same reason why changing project(..., default_options: []) has no effect. I don't think that's the desired behavior and it's a recurent source of confusion. It is actually not that much work to fix this, it's just a matter of reading cmd_line.txt file on reconfigure. It's in my todo to fix it eventually.

@dcbaker I think we should at least document this "known issue".

I thought that @jpakkane considered this a feature not a bug, but I could be wrong.

I think the bug is actually in the other direction than you think. I think the desired behavior is that machine files are read _only_ at meson setup and never again without meson setup --wipe, so we shouldn't reconfigure on machine file changes. I think you need to wipe the build directory to make the changes be noticed.

I slept on it, and I'm not sure anymore this even makes sense form user perspective, at least for me.
A target can be seen as Target = F(X,Y,Z) where X,Y,Z are all files/information used to produce Target so on any change in X,Y,Z, F should be reevaluated and produce a new Target which is the exact result of F(X',Y',Z'). So since corss file changes can change the produced binary or target in general, it is really weird to not take all changes into account (not even talking about the dummy config triggered which is really misleading).
I really don't like the fact that it allows to produce a binary which is not a perfect image of current input files state at any moment.

If we want to keep setup different from config and refuse to automatically wipe project, maybe meson should refuse to build when its internal state is different from 'setup files' or maybe yell 'please wipe your project' and say why.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

inigomartinez picture inigomartinez  路  5Comments

elig0n picture elig0n  路  5Comments

eyelash picture eyelash  路  4Comments

nirbheek picture nirbheek  路  5Comments

denizzzka picture denizzzka  路  4Comments