[Scons-users] VariantDir scons crash?

Stijn De Ruyck Stijn.DeRuyck at onsemi.com
Thu Nov 20 05:08:46 EST 2014


Hi,

I have a strange problem.

Short example of what I have:

variantDir="build/"+env['build']+"/ "
sources = []
sources.extend(Glob("device/*.cc",strings=True))
Export('sources')
Export('env')
env.SConscript(
        env['build']+'SConscript',
        variant_dir=variantDir,
        duplicate=0,
        )

Inside the SConscript I have:

Import('env')
Import('sources')
env.AppendUnique(CCFLAGS='-g')
env.Program('#dist/'+env['build']+'/mstcore',sources)

This works. BUT if I replace the Glob inside the sources.extend() with literal strings:

sources.extend("device/Device.cc")
sources.extend("device/Pin.cc")

SCons crashes:

*** running SCons 2.3.0
*** SCONSFLAGS: --warn=no-python-version -j 4 -Q build=deepdebug
*** Running with -j 12
*** Build mode: deepdebug
TypeError: Tried to lookup Dir 'build/deepdebug' as a File.:
  File "/tmp/scratch/projects/deruycks/mstcore/SConstruct", line 504:
    duplicate=0,            #whether to duplicate source code to the variantDir or not (See ch.15)
  File "/usr/lib/scons-2.3.0/SCons/Script/SConscript.py", line 546:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/usr/lib/scons-2.3.0/SCons/Script/SConscript.py", line 260:
    exec _file_ in call_stack[-1].globals
  File "/tmp/scratch/projects/deruycks/mstcore/build/deepdebug/deepdebugSConscript", line 8:
    env.Program('#dist/'+env['build']+'/mstcore',sources) #the hash means "relative to main SConstruct file" instead of "relative to variantDir"
  File "/usr/lib/scons-2.3.0/SCons/Environment.py", line 259:
    return MethodWrapper.__call__(self, target, source, *args, **kw)
  File "/usr/lib/scons-2.3.0/SCons/Environment.py", line 223:
    return self.method(*nargs, **kwargs)
  File "/usr/lib/scons-2.3.0/SCons/Builder.py", line 632:
    return self._execute(env, target, source, OverrideWarner(kw), ekw)
  File "/usr/lib/scons-2.3.0/SCons/Builder.py", line 540:
    source = self.src_builder_sources(env, source, overwarn)
  File "/usr/lib/scons-2.3.0/SCons/Builder.py", line 757:
    return env.arg2nodes(result, source_factory)
  File "/usr/lib/scons-2.3.0/SCons/Environment.py", line 485:
    v = node_factory(self.subst(v, **kw))
  File "/usr/lib/scons-2.3.0/SCons/Node/FS.py", line 1339:
    return self._lookup(name, directory, File, create)
  File "/usr/lib/scons-2.3.0/SCons/Node/FS.py", line 1318:
    return root._lookup_abs(p, fsclass, create)
  File "/usr/lib/scons-2.3.0/SCons/Node/FS.py", line 2223:
    result.must_be_same(klass)
  File "/usr/lib/scons-2.3.0/SCons/Node/FS.py", line 625:
    raise TypeError("Tried to lookup %s '%s' as a %s." %\

The error doesn't make any sense to me...

PS: why I use strings=True in the Glob is so Glob would return strings instead of Nodes. In my example, if Glob would return Nodes to store in the sources list, build output would always be sent to the source directory instead of the variantDir... I got that fixed by letting Glob return strings...


Stijn De Ruyck
Test Methodology Software Engineer
ON Semiconductor
Tel: +32 55 33 29 36

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20141120/71a22dc7/attachment.html>


More information about the Scons-users mailing list