build.zig
fails to compile due to deduplicated lazy dependency
#21771
Labels
bug
Observed behavior contradicts documented or intended behavior
zig build system
std.Build, the build runner, `zig build` subcommand, package management
Milestone
Zig Version
0.14.0-dev.1952+9f84f7f92
Steps to Reproduce and Observed Behavior
If two dependencies depend on the same package,
but one does so lazily and the other one does not,
the
build.zig
of the latter fails to compileif it does not use
lazyDependency()
(which it should not need to use as the dependency is not lazy).
Graphically:
B
fails to compile with:My guess is that the build system marks the deduplicated dependency as lazy even though it is only lazy for
C
, notB
.In more complex dependency graphs this seems to happen about half the time I run
zig build
which leads me to conclude that it's related to dependency traversal order. However in this small example, I'm unable to find a--seed
that works around the issue.So without knowing any internals of the build system, I guess that this is what happens:
D
: One lazy (fromC
), one eager (fromB
).D
are lazy.B
'sbuild.zig
is compiled given the lazyD
in@import("@dependencies")
.I prepared a repository so you can reproduce easily by running
zig build
: https://github.com/dermetfan/zig-issue-lazy-depExpected Behavior
It should not be necessary to use
lazyDependency()
instead ofdependency()
as the dependency is not lazy.The text was updated successfully, but these errors were encountered: