Zig Version
0.12.0-dev.1751+7fbbeae617
Steps to Reproduce and Observed Behavior
git clone https://github.com/kristoff-it/zine.git
cd zine
git checkout 51ccbc3bd0d1e4ac9c3c4fe1903a5409f0eb9685
cd sample_website
zig build
This first part will fail with a compile error in the stdlib.
Apply the following patch to fix the problem:
diff --git a/lib/std/Build/Step/Run.zig b/lib/std/Build/Step/Run.zig
index 5555b03e94..369b66e9f6 100644
--- a/lib/std/Build/Step/Run.zig
+++ b/lib/std/Build/Step/Run.zig
@@ -249,7 +249,7 @@ pub fn addDepFileOutputArg(self: *Run, basename: []const u8) std.Build.LazyPath
/// Add a prefixed path argument to a dep file (.d) for the child process to
/// write its discovered additional dependencies.
/// Only one dep file argument is allowed by instance.
-pub fn addPrefixedDepFileOutputArg(self: *Run, prefix: []const u8, basename: []const u8) void {
+pub fn addPrefixedDepFileOutputArg(self: *Run, prefix: []const u8, basename: []const u8) std.Build.LazyPath {
assert(self.dep_output_file == null);
const b = self.step.owner;
@@ -264,6 +264,8 @@ pub fn addPrefixedDepFileOutputArg(self: *Run, prefix: []const u8, basename: []c
self.dep_output_file = dep_file;
self.argv.append(.{ .output = dep_file }) catch @panic("OOM");
+
+ return .{ .generated = &dep_file.generated_file };
}
Running zig build after that should succeed.
Running zig build again (ie on a cache hit) will fail:
$ zig build
install generated to baz/whatever/index.html: error: unable to update file from '/home/kristoff/zine/sample_website/zig-cache/o/56660d364e545b02a544b268698bca9e/whatever' to '/home/kristoff/zine/sample_website/zig-out/baz/whatever/index.html': FileNotFound
install generated to foo/index.html: error: unable to update file from '/home/kristoff/zine/sample_website/zig-cache/o/25c618c4900deb1d03d26b717bda2688/foo' to '/home/kristoff/zine/sample_website/zig-out/foo/index.html': FileNotFound
install generated to bar/index.html: error: unable to update file from '/home/kristoff/zine/sample_website/zig-cache/o/233b571fe011054566258c9bbc959574/bar' to '/home/kristoff/zine/sample_website/zig-out/bar/index.html': FileNotFound
Build Summary: 19/23 steps succeeded; 3 failed (disable with --summary none)
install transitive failure
├─ install generated to bar/index.html failure
├─ install generated to foo/index.html failure
└─ install generated to baz/whatever/index.html failure
error: the following build command failed with exit code 1:
/home/kristoff/zine/sample_website/zig-cache/o/c4ae6ae03cf8b6f19546c8a2b54d5b44/build /home/kristoff/zig/build/stage3/bin/zig /home/kristoff/zine/sample_website /home/kristoff/zine/sample_website/zig-cache /home/kristoff/.cache/zig --seed 0x9680398a
Making a small change to layouts/page.html will cause the build to suceed again once, which could be useful for debugging.
Invoking zig build with the --verbose flag shows that the hashes of the output files change between where they are initially placed, and where they are expected to be on a cache hit.
Expected Behavior
A cache hit should successfully find the cached artifacts.
Zig Version
0.12.0-dev.1751+7fbbeae617
Steps to Reproduce and Observed Behavior
This first part will fail with a compile error in the stdlib.
Apply the following patch to fix the problem:
Running
zig buildafter that should succeed.Running
zig buildagain (ie on a cache hit) will fail:Making a small change to
layouts/page.htmlwill cause the build to suceed again once, which could be useful for debugging.Invoking
zig buildwith the--verboseflag shows that the hashes of the output files change between where they are initially placed, and where they are expected to be on a cache hit.Expected Behavior
A cache hit should successfully find the cached artifacts.