-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Auto header dependencies don't work with generated enums #1084
Comments
make a lib1 dependency.
... something like that should work. |
Aha, that does work, thanks. This still isn't ideal; at minimum the docs at https://github.com/mesonbuild/meson/wiki/Gnome-module for |
This isn't simply a mkenums problem. Meson tracks dependencies so you have to be explicit about what depends upon what. Your executable depends upon a CustomTarget that generates a header and a library. The library and header are two different unrelated things until you tie them together with EDIT: Sorry I see that the lib should be generating the enums in the first place, that might be a bug. |
Yeah; to me it seems reasonable that I have to manually list the generated header as a source of the library, but from there Meson should be able to figure that anything that depends on the library also depends on the generated header. |
Here's my testcase in full: Build fails 1st time and succeeds second time (if you run with |
Does the race condition still happen if you do
|
btw, when I run your test case, meson/ninja gets stuck in an infinite loop - weird.
|
There are two different kinds of generated headers: internal and external. Meson can not tell which one is which. The developer has to specify it explicitly somehow. Adding a dependency on all headers bloats the Ninja file and is a parallelisation hurdle. |
Yes
OK. So I guess the only thing we can do is update the docs for gnome.mkenums() to make it clear that anyone using generated enum headers in a library cannot use |
argh, although that solution fixes the testcase, it creates some new error in the Tracker build system:
This is kind of cryptic, but my guess is that if the dependency created by |
The build file makes the issue clear. We build and link in separate invocations. We could do it in one go, but I think we don't because Ninja cannot handle gcc depfiles with multiple outputs. So here's the compile step with all its dependency steps:
And this is the link step + dependencies:
The library dependency is a Do you see anything wrong with this assessment? |
@ssssam Adding the custom target twice in depends should not cause this. Could you link us to the branch which has your meson build file? Also, I've added a note about generated sources to the mkenums documentation. |
The branch is here: https://git.gnome.org/browse/tracker/log/?h=wip/sam/meson I experience the issue with Meson commit ac78ae4 |
I don't see any |
Sorry, yeah. It's pushed now
…On Mon, Nov 28, 2016 at 8:17 PM, Nirbheek Chauhan ***@***.***> wrote:
I don't see any tracker-enum-types.h generation in that branch. Is it
something that you haven't pushed yet?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1084 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAYunPSkYIcECdP-239TcGG50Y84m6Iks5rCzb2gaJpZM4K44Zu>
.
|
I still don't see any |
We're getting deep into the 21st century but I still can't use Git correctly half the time. Here's the actual commit in which I add enum generation, now actually 100% pushed: https://git.gnome.org/browse/tracker/commit/?h=wip/sam/meson&id=4256465c7f4659d26ed01e2cf8ef561afaa8e910 Sorry for the confusion ! |
I've managed to get a successful build (with various changes on top the half-finished branch I pushed there) just by commenting out the 'Duplicate outputs' check. So I guess what's happening is some kind of false positive when the generated enum header required by libtracker-common ends up being a source of the various Vala libraries and programs that link to libtracker-common. What problem does the 'duplicate outputs' check prevent? |
If you have multiple steps producing the same output file, then choosing which one to use is undecidable and is probably dealt with similar to undefined behaviour in C. That is: the right thing might happen or anything at all might happen. |
I've managed to distill a testcase: ssssam@6a22ac1 This also has made me realise that it's possible to work around this issue by removing anywhere that a dependency is listed 'redundantly'. For example, if dep_a depends on dep_b, a program that only depends on dep_a will not trigger the issue (and will link against dep_b implicitly), while a program that explicitly depends on dep_a and dep_b will produce this sort of cryptic error:
That makes sense. In this case there should be only one step generating |
Our transitive dependencies do need a bit more thinking over. This is part of #1057. |
The same vapi or vala might be added multiple times. Don't freak out if that happens. Only freak out if a vapi or vala generated source by the same name and the output same path is added twice. This should never happen anyway since we would refuse to create the target in the first place in theory, but it might happen because of bugs in generators and custom targets. Closes mesonbuild#1084
This is essentially a revert of https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/326. This commit had the unintended side effect that the built sources are actually rebuilt for every individual user of libmutter_dep. With there being more tests, the number of targets to build is getting too high. Not doing this reduces the number of targets from 2044 to 874, thus saving man hours and CI burnt cycles in the long run. There's the slight risk of reintroducing the random build breaks, but mutter is essentially doing as suggested at mesonbuild/meson#1084 (the only difference being addressed in the previous commit), so it should work on the meson side.
This is essentially a revert of https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/326. This commit had the unintended side effect that the built sources are actually rebuilt for every individual user of libmutter_dep. With there being more tests and generated files, the number of targets to build is increasing squarely. Not doing this reduces the number of targets from 2044 to 874, thus saving man hours and CI burnt cycles in the long run. There's the slight risk of reintroducing the random build breaks, but mutter is essentially doing as suggested at mesonbuild/meson#1084 (the only difference being addressed in the previous commit), so meson ought to behave as expected.
This is essentially a revert of https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/326. This commit had the unintended side effect that the built sources are actually rebuilt for every individual user of libmutter_dep. With there being more tests and generated files, the number of targets to build is increasing squarely. Not doing this reduces the number of targets from 2044 to 874, thus saving man hours and CI burnt cycles in the long run. There's the slight risk of reintroducing the random build breaks, but mutter is essentially doing as suggested at mesonbuild/meson#1084 (the only difference being addressed in the previous commit), so meson ought to behave as expected. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1458
This is essentially a revert of https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/326. This commit had the unintended side effect that the built sources are actually rebuilt for every individual user of libmutter_dep. With there being more tests and generated files, the number of targets to build is increasing squarely. Not doing this reduces the number of targets from 2044 to 874, thus saving man hours and CI burnt cycles in the long run. There's the slight risk of reintroducing the random build breaks, but mutter is essentially doing as suggested at mesonbuild/meson#1084 (the only difference being addressed in the previous commit), so meson ought to behave as expected. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1458
Given this meson.build file:
When I build this with a clean build directory, I get the following error:
I can work around this issue by listing enums[1] as a source to the executable. But that's no good; imagine if I have 50 testcases for lib1 -- I shouldn't have to list the enum header file as a source for each of those testcases.
The text was updated successfully, but these errors were encountered: