authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-08-04 16:23:58+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-08-04 16:23:58+01:00
log9b509dad30a9e7fa6f59e656c0df2b7e265b400a
tree2bbfa87fa2deb1fe8d8cf12abe8f3b05d4f03c6f
parent70c6a9fba67a10838cfbbc7554cfa164e9b06462
parent422e8d476c4f407abe2915932fc01012682051fe
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #24689 from mlugg/build-no-watch-regression

build runner: fix FTBFS on targets without `--watch` implementation

2 files changed, 21 insertions(+), 0 deletions(-)

lib/compiler/build_runner.zig+3
...@@ -502,6 +502,9 @@ pub fn main() !void {...@@ -502,6 +502,9 @@ pub fn main() !void {
502 };502 };
503 }503 }
504504
505 // Comptime-known guard to prevent including the logic below when `!Watch.have_impl`.
506 if (!Watch.have_impl) unreachable;
507
505 try w.update(gpa, run.step_stack.keys());508 try w.update(gpa, run.step_stack.keys());
506509
507 // Wait until a file system notification arrives. Read all such events510 // Wait until a file system notification arrives. Read all such events
src/main.zig+18
...@@ -4893,6 +4893,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {...@@ -4893,6 +4893,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
4893 var fetch_mode: Package.Fetch.JobQueue.Mode = .needed;4893 var fetch_mode: Package.Fetch.JobQueue.Mode = .needed;
4894 var system_pkg_dir_path: ?[]const u8 = null;4894 var system_pkg_dir_path: ?[]const u8 = null;
4895 var debug_target: ?[]const u8 = null;4895 var debug_target: ?[]const u8 = null;
4896 var debug_libc_paths_file: ?[]const u8 = null;
48964897
4897 const argv_index_exe = child_argv.items.len;4898 const argv_index_exe = child_argv.items.len;
4898 _ = try child_argv.addOne();4899 _ = try child_argv.addOne();
...@@ -5016,6 +5017,14 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {...@@ -5016,6 +5017,14 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
5016 } else {5017 } else {
5017 warn("Zig was compiled without debug extensions. --debug-target has no effect.", .{});5018 warn("Zig was compiled without debug extensions. --debug-target has no effect.", .{});
5018 }5019 }
5020 } else if (mem.eql(u8, arg, "--debug-libc")) {
5021 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});
5022 i += 1;
5023 if (build_options.enable_debug_extensions) {
5024 debug_libc_paths_file = args[i];
5025 } else {
5026 warn("Zig was compiled without debug extensions. --debug-libc has no effect.", .{});
5027 }
5019 } else if (mem.eql(u8, arg, "--verbose-link")) {5028 } else if (mem.eql(u8, arg, "--verbose-link")) {
5020 verbose_link = true;5029 verbose_link = true;
5021 } else if (mem.eql(u8, arg, "--verbose-cc")) {5030 } else if (mem.eql(u8, arg, "--verbose-cc")) {
...@@ -5103,6 +5112,14 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {...@@ -5103,6 +5112,14 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
5103 .is_explicit_dynamic_linker = false,5112 .is_explicit_dynamic_linker = false,
5104 };5113 };
5105 };5114 };
5115 // Likewise, `--debug-libc` allows overriding the libc installation.
5116 const libc_installation: ?*const LibCInstallation = lci: {
5117 const paths_file = debug_libc_paths_file orelse break :lci null;
5118 if (!build_options.enable_debug_extensions) unreachable;
5119 const lci = try arena.create(LibCInstallation);
5120 lci.* = try .parse(arena, paths_file, &resolved_target.result);
5121 break :lci lci;
5122 };
51065123
5107 process.raiseFileDescriptorLimit();5124 process.raiseFileDescriptorLimit();
51085125
...@@ -5367,6 +5384,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {...@@ -5367,6 +5384,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
5367 }5384 }
53685385
5369 const comp = Compilation.create(gpa, arena, .{5386 const comp = Compilation.create(gpa, arena, .{
5387 .libc_installation = libc_installation,
5370 .dirs = dirs,5388 .dirs = dirs,
5371 .root_name = "build",5389 .root_name = "build",
5372 .config = config,5390 .config = config,