[Scons-users] solving dependency cycle

Chris BeHanna chris at behanna.org
Fri Aug 17 13:03:58 EDT 2012


On Aug 17, 2012, at 05:21 , Kraus Philipp <philipp.kraus at flashpixx.de> wrote:


> Hello,

>

> how can I solve "dependency cycles" ?

>

> I have got 3 source files (a, b c) that creates one target

> finally = env.Program( ..., sources=[a,b,c] )

>

> I have got a previous target x on which a, b and c depends:

>

> finally depends on a, b, c

> a depends on x

> b depends also on x

> c depends also on x

>

> Scons creates the error, that it detects a dependy cycle. There is one, because

> three targets depend on one. How can I solve this problem?

> I try to use "SideEffect", so that only one of the targets builds x, but the cycle exists also

> and Scons create an error. Can I tell scons, that it use only one branch of the graph to build x

> and ignores the other one?


Typically, to break such cycles, you have to refactor your code. This is sometimes nontrivial. Note that what you have described, however, is not a cycle:

a -> x
b -> x
c -> x

is not a cycle unless x also depends upon one of a, b, or c.

--
Chris BeHanna
chris at behanna.org


More information about the Scons-users mailing list