Absolute and cwd-relative paths in build cache #32097

Open
opened 2026-04-27 19:55:34 +02:00 by psznm · 1 comment
Contributor

Zig Version

0.16.0

Steps to Reproduce and Observed Behavior

zig build --summary new # fresh build, builds all
cd src
zig build --summary new # fully cached, builds all anyway
( cd proj1 && zig build --summary new ) # fresh build, builds all
mv proj1 proj2
( cd proj2 && zig build --summary new ) # fully cached, builds all anyway

Cache contains absolute paths and cwd relative paths. This causes cache misses when

  • path relative to project root from cwd is not the same as last build
  • project directory has moved (when copied, no cache miss happens because the cache looks at the original directory)
  • project directory is mounted to container which does not see the original directory

Expected Behavior

Build should remain cached even when changing cwd or moving project directory. In other words, there should not be cwd-relative nor absolute paths in the cache.

### Zig Version 0.16.0 ### Steps to Reproduce and Observed Behavior ```sh zig build --summary new # fresh build, builds all cd src zig build --summary new # fully cached, builds all anyway ``` ```sh ( cd proj1 && zig build --summary new ) # fresh build, builds all mv proj1 proj2 ( cd proj2 && zig build --summary new ) # fully cached, builds all anyway ``` Cache contains absolute paths and cwd relative paths. This causes cache misses when - path relative to project root from cwd is not the same as last build - project directory has moved (when copied, no cache miss happens because the cache looks at the original directory) - project directory is mounted to container which does not see the original directory ### Expected Behavior Build should remain cached even when changing cwd or moving project directory. In other words, there should not be cwd-relative nor absolute paths in the cache.
alexrp added this to the 0.17.0 milestone 2026-04-27 20:01:56 +02:00
For completeness sake: I brought this up https://ziggit.dev/t/recompiling-of-build-zig-when-changing-to-a-subdirectory/14758 There is also a closed (non-accepted) PR ( https://codeberg.org/ziglang/zig/pulls/31626 )
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ziglang/zig#32097
No description provided.