Re: SCons missing dependencies (not rebuilding files when they need to be)
Bill Deegan <bill-cJFiu+DHMVC5azolltMz9laTQe2KTcn/@public.gmane.org>
| Newsgroups | gmane.comp.programming.tools.scons.devel |
|---|---|
| Message-ID | <CAEyG4CGx5EOZbdTQKJb+=W1amXxQi=sU+gV764C5rra4niqMbQ@mail.gmail.com> |
On Fri, May 6, 2016 at 1:09 PM, Krzysztof Trzciński < [email protected]> wrote: > New SConstruct: > > env = Environment(tools=['default', 'textfile']) > > prints = [] > for num in (1,2): > printcc = env.Textfile( > '{0}/print.cc'.format(num), > [( > '#include <iostream>\n' > '#include <fstream>\n' > 'int main(int argc, char **argv)\n' > '{{\n' > ' std::cout << "Printing " << {0} << std::endl;\n' > ' std::ofstream f(argv[2]);\n' > ' f << {0} << "\\n";\n' > ' return 0;\n' > '}}\n' > ).format(num),], > ) > > > prints.extend(env.Program( > '{0}/print'.format(num), > printcc > )) > > env['SHCXX'] = prints[int(ARGUMENTS['use_task'])] > > result = env.SharedObject(printcc) > > Default(prints+result) > > Results: > > $ scons use_task=0 > scons: Reading SConscript files ... > scons: done reading SConscript files. > scons: Building targets ... > Creating '1/print.cc' > g++ -o 1/print.o -c 1/print.cc > g++ -o 1/print 1/print.o > Creating '2/print.cc' > g++ -o 2/print.o -c 2/print.cc > g++ -o 2/print 2/print.o > 1/print -o 2/print.os -c -fPIC 2/print.cc > Printing 1 > scons: done building targets. > > $ cat 2/print.os > 1 > > # Build with different compiler > > $ scons use_task=1 > scons: Reading SConscript files ... > scons: done reading SConscript files. > scons: Building targets ... > scons: `1/print' is up to date. > scons: `2/print' is up to date. > scons: `2/print.os' is up to date. > scons: done building targets. > > $ cat 2/print.os > 1 > > # Did not refresh! > > # Just to double check from clean: > > $ rm 2/print.os > > $ scons use_task=1 > scons: Reading SConscript files ... > scons: done reading SConscript files. > scons: Building targets ... > scons: `1/print' is up to date. > scons: `2/print' is up to date. > 2/print -o 2/print.os -c -fPIC 2/print.cc > Printing 2 > scons: done building targets. > > $ cat 2/print.os > 2 > > > I don't think I should be putting compiler as "source" in `SharedObject`. > You don't have to, it's automatically added. Try running --tree=prune. > > Note that all Textfile/Program builders do here is make this self > contained. > The actual issues is with last three lines. > > In my case it was just that "prints" was populated using operating system > provided paths/binaries to compilers. > > So I take this is a bug and it needs fixing? (if someone could point me in > right direction I could try that, but I am not quite sure where substitions > take place and why $SHXCC would behave differently to $SHCXX.path in a > command). > Don't file a bug yet. Let me dig into this a little bit and get back to you. May take a couple days. -Bill _______________________________________________ Scons-dev mailing list [email protected] https://pairlist2.pair.net/mailman/listinfo/scons-dev