-
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
Support multiple outputs in gcc depfile #1184
Comments
It's a valid feature request, and we should figure out how to do this. In the meantime, maybe meson could add |
I am experimenting with meson for use with in IDL compiler (flatcc for flatbuffers). The tool generates a single depfile, currently only with one target, but in reality it has multiple targets: myschema_reader.h, myschema_builder.h etc., but furthermore there are included subschema subschema1_reader.h etc. It suffice to depend on the top-level myschema_reader.h for correct builds usually, but the ninja clean reports errors with subschema. There is a related issue about ninja not supporting dynamically generated output such as subschema1_reader.h, even if it supports dynamically generated dependencies, so I'm not sure if it is that simple to get clean working. I'm only learning meson, so there may be mistakes, but in this rule file there are more comments on my experience: https://github.com/dvidelabs/flatcc/blob/meson/rules/meson.build |
"ninja clean" can only delete files it knows about; if at all possible, I recommend putting your build output in a different directory so cleaning is as easy as |
Wrt. separate build dir, that already happens, so it is not a showstopper. |
If we do that Ninja will immediately halt saying that dep file has more than one output. We simply can't enable it until this is fixed. Nobody would be able to compile code with that. For more details see this bug in Gnome's bugzilla. |
There is a subset of this behaviour that might be simpler to fix: A depfile with additional outputs that don't have any dependencies. Like this:
Compilers output these additional targets for each of the dependencies so that This solution would seem to handle the Gnome bug that @jpakkane mentioned in the previous comment. C pre-processors are configurable enough that you can turn off those phony targets (GCC only produces them if you add |
This includes phony targets for each dependency in the the generated dependency file which allows building with `ninja` which doesn't like the phony targets[1] but also allows silencing `make` errors similar to gcc's -MP option. [1] - ninja-build/ninja#1184 https://bugzilla.gnome.org/show_bug.cgi?id=774368
For anyone that is being blocked by this issue, you may find these pull requests and patches helpful: |
#1534 should have fixed this (and is in 1.10.0). |
Previous link was to ninja release of version 1.7.2, which caused a build error on Windows (raises multiple outputs aren't (yet?) supported by depslog;" which according to - ninja-build/ninja#1184 should be fixed in ninja version >=1.10. Changed the link to current latest which is 1.12.1
This has been around a long time and is known to be difficult. However this is becoming more and more acute. There are many compilers that produce multiple files for each input, for example Fortran produces
.o
and.mod
. Some compilers want to compile many files at once, e.g.somecomp -c foo1.src foo2.src foo3.src
which produces three object files in one go.In Meson we are getting reports from users who have custom compile steps such as converting one IDL file to multiple source files where this fails because depslog can have deps only for one output file.
Please add this functionality. Thanks.
The text was updated successfully, but these errors were encountered: