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
determine_windows_extra_paths() returns list of dependency paths in random order, breaks building glib #12330
Comments
@bruchar1 since you touched this last. Do you have any thoughts on how to best fix this? |
@lazka I think you can just change |
@lazka OOC, what's the expected order? builddir or system first? In related news, in #12059 I rework a lot that function, but I didn't pay attention to ordering, so that code needs revisiting too.
That's a fair point, I personally thought that set() was ordered the same way dict now are. That's a huge trap, we probably should do a project wide search-and-replace to never use it! |
There are many, many, many cases where sets are entirely correct to use because order doesn't matter. Why would we ever want to replace those? There are a bunch of cases where we know order matters and we use mesonlib.OrderedSet, again, as we should. There is apparently at least one case where order matters and we did NOT use mesonlib.OrderedSet, and we can fix that on its own. |
OOC Is there a reason no to? Unstable order bit us many times for reproducibility, it's often far from obvious that order actually matters. |
|
It's tangential, I'm not really proposing to do it here. But wouldn't that be just a dict with None value? That would have pretty similar perf, no? To be honest I wrongly assumed that set() was actually a dict and was ordered the same way. |
The reason I'm saying this is because it's not only about args order, it's also anything that gets pickled into coredata or any other president state that would cause spurious reconfigure. We felt into that trap many times already. |
I did a few tests with |
Wondering how you get such huge difference. There is some variability, set() and dict() always have similar perf, but wrapping dict into a class does have a 10-15% cost.
Anyway, that's offtopic, sorry. |
I should have been clearer, initialization with values. so something like EDIT: Here's my test script: import timeit
from mesonbuild.mesonlib import OrderedSet
print('base initialization:')
print('list:', timeit.timeit(list))
print('set:', timeit.timeit(set))
print('OrderedSet:', timeit.timeit(OrderedSet))
x = list(range(10))
print('\ninitialization with values:')
print('list:', timeit.timeit(lambda: list(x)))
print('set:', timeit.timeit(lambda: set(x)))
print('OrderedSet:', timeit.timeit(lambda: OrderedSet(x)))
print('\nelement addition (no repeat):')
print('list:', timeit.timeit(lambda: list().append(7)))
print('set:', timeit.timeit(lambda: set().add(7)))
print('OrderedSet:', timeit.timeit(lambda: OrderedSet().add(7)))
print('\nelement addition (repeat):')
y = set()
print('set:', timeit.timeit(lambda: y.add(7)))
y = OrderedSet()
print('OrderedSet:', timeit.timeit(lambda: y.add(7)))
print('\nmembership (present):')
print('list:', timeit.timeit(lambda: 7 in x))
y = set(x)
print('set:', timeit.timeit(lambda: 7 in y))
y = OrderedSet(x)
print('OrderedSet:', timeit.timeit(lambda: 7 in y))
print('\nmembership (missing):')
print('list:', timeit.timeit(lambda: 17 in x))
y = set(x)
print('set:', timeit.timeit(lambda: 17 in y))
y = OrderedSet(x)
print('OrderedSet:', timeit.timeit(lambda: 17 in y)) and here's the results: base initialization:
list: 0.031823622004594654
set: 0.035224589984863997
OrderedSet: 0.31845129901194014
initialization with values:
list: 0.1108416179777123
set: 0.2433469349925872
OrderedSet: 1.3216239210159983
element addition (no repeat):
list: 0.1217501929786522
set: 0.12117283698171377
OrderedSet: 0.5398813229985535
element addition (repeat):
set: 0.07545559998834506
OrderedSet: 0.15576225699624047
membership (present):
list: 0.11119814799167216
set: 0.056258563010487705
OrderedSet: 0.12434810600825585
membership (missing):
list: 0.13001264000195079
set: 0.059524321026401594
OrderedSet: 0.13463887601392344 So what I see is even in optimal cases OrderedSet is significantly slower than set, and even slower than list in some cases (that surprises me). |
Right, that's indeed the worst case scenario. Note that our implementation can be improved, |
Since there is no guarantee with system dependencies that they wont inject DLLs that conflict with other dependencies I'd say sort all system dependencies (anything not in the meson build dir) at the end. |
This works around a Meson bug where a system-wide installed copy of GLib can incorrectly get used in preference to the just-built copy (see mesonbuild/meson#12330). In principle some of these are unnecessary (for example libgio-2.0-0.dll only needs to be in gio/tests/ and girepository/tests/) but it's simpler to copy each DLL to each tests directory. Fixes: c428d6e "ci: Build and tar the platform specific documentation" Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/3262 Signed-off-by: Simon McVittie <smcv@collabora.com>
This works around a Meson bug where a system-wide installed copy of GLib can incorrectly get used in preference to the just-built copy (see mesonbuild/meson#12330). In principle some of these are unnecessary (for example libgio-2.0-0.dll only needs to be in gio/tests/ and girepository/tests/) but it's simpler to copy each DLL to each tests directory. Fixes: c428d6e "ci: Build and tar the platform specific documentation" Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/3262 Signed-off-by: Simon McVittie <smcv@collabora.com>
Rather than pinning it to the lowest version we support, as is the standard policy. This means we’ll end up using version 1.3.2-2, which has just been packaged to contain the fix for mesonbuild/meson#12330, which has been impacting GLib significantly since we started installing gobject-introspection in CI in commit c428d6e. Thanks to Christoph Reiter, Luca Bacci and Simon McVittie for diagnosing and fixing this issue. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Fixes: #3262
glib is currently not buildable in case glib is already installed on the system, this is due to some glib build commands trying to link to system glib during the build which is missing some new symbols. See downstream issue: https://gitlab.gnome.org/GNOME/glib/-/issues/3114
A bit of debugging shows that the PATH env var passed to commands (serialized via "extra_paths") is in a different order on every configure run. Looking at the function filling it shows that it uses unordered sets for everything and mixes build and system dependencies in multiple places and puts them into the same set():
meson/mesonbuild/backend/backends.py
Line 1159 in 179355b
So sometimes the system DLL is in PATH before the meson built one.
Site note: whatever the fix is here, avoiding set() with deterministic output would help hunt down future issues in that code
The text was updated successfully, but these errors were encountered: