-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid build.ninja changes due to order of hash table iteration #7900
Conversation
9b12162
to
e1a55bb
Compare
e1a55bb
to
a83a3e9
Compare
This should probably use |
Sometimes it should (and the patches do), especially if that affects the build command line directly. In fact for sourcesets the pull request is already using For dictionaries in In the remaining cases (depfiles in the first patch and ninjabackend) Meson uses |
By the way, there is a precedent for sorting the keys in the output in |
36633ff
to
3e39971
Compare
The order of elements in sets cannot be relied upon, because the hash values are randomized by Python. Whenever sets are converted to lists we need to keep their order stable, or random changes in the command line cause ninja to rebuild a lot of files unnecessarily. To stabilize them, use either sort or OrderedSet. Sorting is not always applicable, but it can be faster because it's done in C and it can produce slightly nicer output.
The order of keys in dictionaries cannot be relied upon, because the hash values are randomized by Python. Whenever we iterate on dictionaries and meson.build generates a list during the iteration, the different iteration orders may cause random changes in the command line and cause ninja to rebuild a lot of files unnecessarily.
…cies These do not go into the command line, and therefore do not matter for the purpose of avoiding unnecessary rebuilds after meson is rerun. However, they complicate the task of finding differences between build lines across meson reruns. So take the easy way out and sort everything after | and ||. With this change, there is absolutely no change in QEMU's 40000-line build.ninja file after meson is rerun.
3e39971
to
0b2865e
Compare
I thought about this some more and it is in fact important that we preserve the order given. For example:
If both lib1 and lib2 are static libraries and 1 depends on symbols from 2, it must come first on the link line at least with GNU ld. Now it could be said that this is wrong as 1 should have a dependency on 2 but sometimes that does not work (especially if those are internal helper libraries). Now the fact that we have not gotten bug reports about this implies that this is not actually happening in the real world. Still, I'd prefer |
You're probably thinking of commit "ninjabackend: stabilize order of dependencies and order-only dependencies" which changes the order of ninja dependencies, not Meson dependency objects. That is, in a rule
The The sourceset patch is the only one that deals with Meson dependencies and also the only one that uses |
The main advantage of 0.57 is that it fixes mesonbuild/meson#7900, thus avoiding unnecessary rebuilds after running meson. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
The main advantage of 0.57 is that it fixes mesonbuild/meson#7900, thus avoiding unnecessary rebuilds after running meson. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
The main advantage of 0.57 is that it fixes mesonbuild/meson#7900, thus avoiding unnecessary rebuilds after running meson. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
The main advantage of 0.57 is that it fixes mesonbuild/meson#7900, thus avoiding unnecessary rebuilds after running meson. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
The update to 0.57 has been delayed due to it causing warnings for some actual issues, but it brings in important bugfixes and new features. 0.58 also brings in a bugfix that is useful for modinfo. Important bugfixes: - 0.57: mesonbuild/meson#7760, build: use PIE objects for non-PIC static libraries if b_pie=true - 0.57: mesonbuild/meson#7900, thus avoiding unnecessary rebuilds after running meson. - 0.58.2: mesonbuild/meson#8900, fixes for passing extract_objects() to custom_target (useful for modinfo) Features: - 0.57: the keyval module has now been stabilized - 0.57: env argument to custom_target (useful for hexagon) - 0.57: Feature parity between "meson test" and QEMU's TAP driver - 0.57: mesonbuild/meson#8231, allows bringing back version numbers in the configuration summary Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
The update to 0.57 has been delayed due to it causing warnings for some actual issues, but it brings in important bugfixes and new features. 0.58 also brings in a bugfix that is useful for modinfo. Important bugfixes: - 0.57: mesonbuild/meson#7760, build: use PIE objects for non-PIC static libraries if b_pie=true - 0.57: mesonbuild/meson#7900, thus avoiding unnecessary rebuilds after running meson. - 0.58.2: mesonbuild/meson#8900, fixes for passing extract_objects() to custom_target (useful for modinfo) Features: - 0.57: the keyval module has now been stabilized - 0.57: env argument to custom_target (useful for hexagon) - 0.57: Feature parity between "meson test" and QEMU's TAP driver - 0.57: mesonbuild/meson#8231, allows bringing back version numbers in the configuration summary Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
The update to 0.57 has been delayed due to it causing warnings for some actual issues, but it brings in important bugfixes and new features. 0.58 also brings in a bugfix that is useful for modinfo. Important bugfixes: - 0.57: mesonbuild/meson#7760, build: use PIE objects for non-PIC static libraries if b_pie=true - 0.57: mesonbuild/meson#7900, thus avoiding unnecessary rebuilds after running meson. - 0.58.2: mesonbuild/meson#8900, fixes for passing extract_objects() to custom_target (useful for modinfo) Features: - 0.57: the keyval module has now been stabilized - 0.57: env argument to custom_target (useful for hexagon) - 0.57: Feature parity between "meson test" and QEMU's TAP driver - 0.57: mesonbuild/meson#8231, allows bringing back version numbers in the configuration summary - 0.59: Utility methods for feature objects Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
The ordering of elements in sets and of keys in dictionaries cannot be relied upon, because the hash values are randomized by Python. Whenever the processing of
meson.build
or the operation of the backend is affected by this ordering, random changes in the command line can occur and cause ninja to rebuild a lot of files unnecessarily.This pull request fixes the instances that affect QEMU, and which were causing about 40% of the build to be repeated after
touch ../meson.build
(most of them due to sourcesets).