[Scons-users] Dependency scanning of generated source code files

Tom Tanner (BLOOMBERG/ LONDON) ttanner2 at bloomberg.net
Mon Apr 15 07:35:02 EDT 2013


I've been somewhat confused as to why my builds break randomly, and I think I've found the problem.

Part of the build generates both source code and header files, then builds an object from the result. Which I would have thought wouldn't be an issue. However, it appears to destroy the dependencies for the .o target somehow, as if I change something use to generate the source and header files, and build with --debug=explain I get something like this:

--- builds thing.cc because another_file has been changed
--- builds thing.hh because another_file has been changed
--- builds thing1.hh because another_file has been changed

scons: rebuilding 'so_thing.o' because:
'thing.hh' is no londer a dependancy
'thing1.hh' is no longer a dependancy
....
and so on for every #include in thing.cc

And if you also dump the tree output, you see that the .o is indeed not dependant on those .hh files.

the next time you do this process, you get
scons: rebuilding so_thing.o because thing.cc changed
even though multiple header files have changed.

All this occasionally results (especially if you are building in parallel) in so_thing.o being built /before/ one or other of the requisite header files have been built.

So, how do I get the source code file to be rescanned after it is regenerated? and/or why is the scan producing an empty list?


More information about the Scons-users mailing list