Odd target ordering with generators and extracted objects #12292
Unanswered
mitchgrout
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This situation is best demonstrated with an MVP. Note that I am not suggesting that the following code is good, but instead results in an unexpected
build.ninja
file.Suppose we have an external program named
hexdump
with the following syntax:...with the intent of the program being to take an external file, e.g. image assets, and convert them into an array of bytes usable in your program (think
#embed
from C23). Suppose I also have a file namedfoo.bin
that contains irrelevant data, and amain.c
containing:The following would be a valid
meson.build
file:Looking at the
build.ninja
, we can extract the following build rules:We can observe that
main.c.obj
must be compiled afterlibassets.a.p/foo.h
is generated; this is necessary, sincemain.c
refers tofoo.h
as in include. This build configuration will work OK.Now consider adjusting our declared dependency to:
In my eyes, this should be perfectly equivalent; the
build.ninja
disagrees:Note that
main.c.obj
no longer depends onlibassets.a.p/foo.h
, and as such it is possible thatninja
attempts to compilemain.c
before generating any of the headers, resulting in a compilation header due to a missing header.I've reproduced this on meson v1.2.0 / ninja v1.11.1, on Windows 10. I'm not sure whether I would class this as a bug worth fixing, but it's definitely a bit of a surprise. I'm interested in whether the wider team is aware of this?
Beta Was this translation helpful? Give feedback.
All reactions