-
-
Notifications
You must be signed in to change notification settings - Fork 319
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
VariantDir breaks dependency tree #2908
Comments
I ran into this in the latest version 3.0.4 with python 3.6 on Ubuntu 14. I am generating source code with a Builder, then using the generated source later in a variant dir path I pass to the Program builder, but scons doesn't seem to make the connection that the generated source is the output of another builder, and just thinks the file doesn't exist without calling the builder that generates the source. The answer here solved it for me by explicitly telling scons that dependency, it would then call my source code builder to generate the file before trying to build with the Program builder. |
@dmoody256 - Can you attache taskmastertrace file on a simple example both with and without the explicit Depends()? |
Example:
|
I believe I'm observing this bug with SCons 3.1.1 Here's a minimal reproduction #!/usr/bin/env python
def make_main_c(target, source, env):
source_file = open(str(target[0]), 'w')
source_file.write('#include <stdio.h>\n')
source_file.write('int main() { printf("Hello World"); }')
source_file.close()
env = Environment()
env.Command(source = None, action = make_main_c, target = 'src/main.c')
env.VariantDir('obj', 'src', duplicate = 0)
env.Program('bin/hello', 'obj/main.c') What happens: SCons forgets that Build output:
A more complete example that attempts to download and compile the googletest library can be found here: https://pastebin.com/HVGnuSQE |
Here's the taskmaster trace for @Cygon's nice simple repro case (which I confirm). It looks like it thinks
|
I have a work in progress branch for this. It doesn't work yet. Also a bigger example from @Cygon |
This issue was originally created at: 2013-05-14 09:21:18.
This issue was reported by:
unclezeiv
.Simple case:
Notice how
src/test.cc
appears several times, but only once the dependency oninput.strings
is correctly identified. Whenbuild/variant1/test.o
correctly resolves tosrc/test.cc
viaVariantDir
, it doesn't seem to remember the dependency - and, as a matter of fact, changinginput.strings
does indeed NOT trigger a recompilation :(Contrast this with the tree that I get when NOT using VariantDir:
This does not only happen when using
Depends()
explicitly. Also adding a custom builder to a node seems to be lost in the process.Any help or workaround would be appreciated. Thank you.
(I'm testing this under Python 2.6 and Linux, but it doesn't look platform dependent).
If you change it to:
Does it work?
In general, if you have a problem, you are better off first bringing it to the attention of the scons users mailing list. And then if it cannot be resolved and/or someone asks you to file it as a bug, then to proceed to do so.
Ok, will do, but let me just clarify that I'm not trying to make this toy example work. It took me a long time to distill the problem to what I think it's its essence. I thought the dependency tree dump was evidence enough of a misbehaviour. But I'll seek for advice on the mailing list first, thanks.
This line is incorrect:
Saying that a source file depends on some other file doesn't cause anything to happen; source files have no builders. It's basically meaningless. Perhaps you mean to say that
src/test.o
(the object file) depends onsrc/input.strings
, i.e. SCons should rebuild test.o wheneverinput.strings
has changed?Hi Gary, that's actually a good point. I should point out though that:
src/test.cc
with a builder. I removed that part as I thought it was not fundamental for describing the problem. And again, even in that case, it works when not using VariantDir, it doesn't otherwise.I poked around the Scons source and it looks like at some stage Scons is aware of
src/test.cc
having a builder and some dependencies, while at some later stage this info is lost. I can give you more details on this if you want, but I don't really understand the code base.Thank you guys for your help.
Votes for this issue: 1.
The text was updated successfully, but these errors were encountered: