[Scons-users] Follow-up: Success depends on target name!

Marc Branchaud mbranchaud at xiplink.com
Mon Oct 22 10:28:48 EDT 2012


On 12-10-20 08:18 PM, Johan Holmberg wrote:

> On Thu, Oct 4, 2012 at 11:19 PM, Marc Branchaud <mbranchaud at xiplink.com> wrote:

>> On 12-10-04 04:57 PM, Marc Branchaud 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 --

>>

>> While crafting the example for this problem, I ran into some really confusing

>> behaviour. The build works after I change the above SConstruct so that mycc

>> is no longer in the tools/ subdirectory:

>>

>> e = DefaultEnvironment()

>> mycc = e.Command(target="mycc",

>> source="/usr/bin/gcc",

>> action="cp $SOURCE $TARGET")

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

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

>>

>> But it fails if I give the Program a different target name! The following

>> names all cause SCons to miss the dependency on mycc:

>> app

>> app2

>> 2app

>> glop

>> gloptest (but testglop works)

>> abcdefg

>> aragon (but waragon works)

>> frodo (but phrodo works)

>> gimli (but qgimli works)

>> legolas (but plegolas works)

>> boromir (but sauron works)

>>

>> I can't imagine what SCons has against the Fellowship of the Ring... :)

>>

>> All these failing target names work if I don't replace CC in the environment.

>> Also, I see the same behaviour in both 1.2.0 and 2.2.0.

>>

>> Can anyone else confirm this weirdness?

>>

>

> I guess you ran SCons by issuing the command without any arguments:

>

> $ scons

>

> Then the order SCons tries to build the targets "mycc" and "testapp"

> (or various Tolkien names), may depend on the names of the targets.

> And "mycc" happens to be built before some of the names and after some

> of the others. I believe Scons *never* understands that "mycc" is

> needed to compile "test.c". If you try running SCons with the

> application name as argument, I think you will find that your build

> file always fails, eg:

>

> $ scons testapp

>

>

> ( You might also notice that all working names are lexicographically >

> "mycc" :).


Good catch!

Yes, specifying "testapp" on the command line makes the build fail.

Also, renaming "mycc" to "Amycc" fixes the broken program names, but *not* if
they're specified on the command line.


> I don't know if this is an accident, but perhaps the SCons

> code tries to build targets in that order if it can't find any

> dependencies that say otherwise. )


Sure seems like it.

I've updated bug 2877 with this info.

Thanks!

M.



More information about the Scons-users mailing list