You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's a repro of a simple build script which breaks if used with --build-file argument:
λ pwd
/Users/matklad/tmp/subdir
λ zig build
const std = @import("std");
pub fn build(b: *std.Build) !void {
const cat = b.addSystemCommand(&.{"cat"});
cat.addFileArg(b.path("./build.zig"));
b.default_step = &cat.step;
}
λ cd ..
λ zig build --build-file subdir/build.zig
cat: subdir/build.zig: No such file or directory
run cat failure
error: the following command exited with error code 1:
cat subdir/build.zig
Build Summary: 0/1 steps succeeded; 1 failed (disable with --summary none)
run cat failure
error: the following build command failed with exit code 1:
subdir/.zig-cache/o/cb04b4aa31661e7fda012bf07da1a9ac/build /Users/matklad/p/tb/work/zig/zig subdir subdir/.zig-cache /Users/matklad/.cache/zig --seed 0x8bc81711 -Z62e7f988d57764ec
The problem here is that cat always gets ~/tmp/subdir as its cwd (which looks correct), but it is passed either ./build.zig or ./subdir/build.zig as an argument, and, in the latter case, the file is not found!
This looks like a design bug to me! It feels like b.build_root.path should not exist, the build shouldn't be able to tell where it is running from that easily.
The text was updated successfully, but these errors were encountered:
matklad
added a commit
to tigerbeetle/tigerbeetle
that referenced
this issue
Feb 20, 2025
Here's a repro of a simple build script which breaks if used with
--build-file
argument:The problem here is that
cat
always gets~/tmp/subdir
as its cwd (which looks correct), but it is passed either./build.zig
or./subdir/build.zig
as an argument, and, in the latter case, the file is not found!This looks like a design bug to me! It feels like
b.build_root.path
should not exist, the build shouldn't be able to tell where it is running from that easily.The text was updated successfully, but these errors were encountered: