[Scons-users] Dependency on $CC tool tripped up by subdir

Marc Branchaud marcnarc at xiplink.com
Thu Oct 4 16:57:26 EDT 2012


Hi all,

I think I've found a bug, but I might be missing something. I'm trying to
use a custom toolchain for my builds. The following SConstruct doesn't work
in SCons 2.2.0 (nor even in SCons 1.2.0):

-- 8< --
e = DefaultEnvironment()

mycc = e.Command(target="tools/mycc",
source="/usr/bin/gcc",
action="cp $SOURCE $TARGET")

e.Replace(CC = mycc[0].abspath)

e.Program(target='testapp', source='test.c')
-- >8 --

This fails with "/path/to/tools/mycc: not found". SCons fails to notice that
it needs to build mycc before testapp. In fact, --tree=prune shows that
testapp and test.o have no dependency on tools/mycc:

+-.
+-SConstruct
+-test.c
+-test.o
| +-test.c
+-testapp
| +-[test.o]
+-tools
+-tools/mycc
+-/usr/bin/gcc
+-/bin/cp

However, it works if I take the "tools/" part out of the mycc target, i.e.:
mycc = e.Command(target="mycc", ...
Moving mycc out of the subdirectory fixes the dependencies:

+-.
+-SConstruct
+-mycc
| +-/usr/bin/gcc
| +-/bin/cp
+-test.c
+-test.o
| +-test.c
| +-[mycc]
+-testapp
+-[test.o]
+-[mycc]

So my question is: Is this a bug, or can someone show me how to get SCons to
automatically build and use tools/mycc for the testapp?

Thanks!

M.


More information about the Scons-users mailing list