[Scons-users] Dependency on $CC tool tripped up by subdir
William Deegan
bill at baddogconsulting.com
Thu Oct 4 17:20:28 EDT 2012
Marc,
On Oct 4, 2012, at 1:57 PM, Marc Branchaud <marcnarc at xiplink.com> wrote:
> 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 test app?
What happens if you change it to this:
> e = DefaultEnvironment()
>
> mycc = e.Command(target="tools/mycc",
> source="/usr/bin/gcc",
> action="cp $SOURCE $TARGET")
>
> e.Replace(CC = 'tools/mycc')
>
> e.Program(target='testapp', source='test.c')
-Bill
More information about the Scons-users
mailing list