[Scons-users] Odd --tree output with out-of-source build

Hartmut Brandt hartmut.brandt at dlr.de
Fri Mar 18 09:46:30 EDT 2022


On Fri, 18 Mar 2022, Mats Wichmann wrote:

MW>On 3/18/22 04:36, Hartmut.Brandt at dlr.de wrote:
MW>> Hi,
MW>> 
MW>>  
MW>> 
MW>> I have a strange dependency problem with running at -j24 and try to
MW>> debug this. Now I discovered an odd behaviour. I have simple setup:
MW>...
MW>> SConstruct:
MW>> 
MW>> env = Environment()
MW>> 
MW>> SConscript('sub1/SConscript', variant_dir='build', duplicate=False)
MW>>  
MW>> SConscript:
MW>> 
MW>> env = Environment()
MW>> 
MW>> p = env.Program('foo', ['foo.cc', 'bar.cc'])
MW>> 
MW>> Now when I run scons –tree=status I get:
MW>> 
MW>> [E b      ]+-.
MW>> [E     C  ]  +-SConstruct
MW>> [E b      ]  +-build
MW>> [ R    C  ]  | +-sub1/SConscript
MW>> [ R    C  ]  | +-sub1/bar.cc
MW>> [E B   C  ]  | +-build/bar.o
MW>...etc
MW>> 
MW>> When I change the variant_dir to something outside the tree
MW>> (/home/user/build/play):
MW>> 
MW>> [E b   C  ]+-.
MW>> [E     C  ]  +-SConstruct
MW>> [E b   C  ]  +-sub1
MW>> [E     C  ]    +-sub1/SConscript
MW>> [E     C  ]    +-sub1/bar.cc
MW>> [E     C  ]    +-sub1/foo.cc
MW>> 
MW>> scons: done building targets.
MW>> 
MW>>  
MW>> 
MW>> which looks odd. Are out-of-tree builds not supported? Could not find
MW>> such a hint in the documentation, but I could easily miss it.
MW>
MW>Supported, but this is a matter of target selection. SCons does not by
MW>default select targets outside the tree, so in your out-of-tree
MW>example,nothing in the variant dir is selected for building, so there's
MW>nothing to report on there.
MW>
MW>https://scons.org/doc/production/HTML/scons-man.html#target_selection

So how do I specify these targets? I would assume I need to specify foo 
with some path like /home/harti/build/play/sub1/foo or just the directories.
None of this works. scons tells me either that it doesn't know how to 
build it or it spits out a python error ('NoneType' object has no 
attribute 'get_contents').

harti


More information about the Scons-users mailing list