diff options
| author | Matthew Lugg <mlugg@mlugg.co.uk> | 2025-08-04 16:23:58 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-04 16:23:58 +0100 |
| commit | 9b509dad30a9e7fa6f59e656c0df2b7e265b400a (patch) | |
| tree | 2bbfa87fa2deb1fe8d8cf12abe8f3b05d4f03c6f /src | |
| parent | 70c6a9fba67a10838cfbbc7554cfa164e9b06462 (diff) | |
| parent | 422e8d476c4f407abe2915932fc01012682051fe (diff) | |
| download | zig-9b509dad30a9e7fa6f59e656c0df2b7e265b400a.tar.gz zig-9b509dad30a9e7fa6f59e656c0df2b7e265b400a.zip | |
Merge pull request #24689 from mlugg/build-no-watch-regression
build runner: fix FTBFS on targets without `--watch` implementation
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.zig | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig index 3316639fee..0efa54ac1e 100644 --- a/src/main.zig +++ b/src/main.zig @@ -4893,6 +4893,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { var fetch_mode: Package.Fetch.JobQueue.Mode = .needed; var system_pkg_dir_path: ?[]const u8 = null; var debug_target: ?[]const u8 = null; + var debug_libc_paths_file: ?[]const u8 = null; const argv_index_exe = child_argv.items.len; _ = try child_argv.addOne(); @@ -5016,6 +5017,14 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { } else { warn("Zig was compiled without debug extensions. --debug-target has no effect.", .{}); } + } else if (mem.eql(u8, arg, "--debug-libc")) { + if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg}); + i += 1; + if (build_options.enable_debug_extensions) { + debug_libc_paths_file = args[i]; + } else { + warn("Zig was compiled without debug extensions. --debug-libc has no effect.", .{}); + } } else if (mem.eql(u8, arg, "--verbose-link")) { verbose_link = true; } else if (mem.eql(u8, arg, "--verbose-cc")) { @@ -5103,6 +5112,14 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { .is_explicit_dynamic_linker = false, }; }; + // Likewise, `--debug-libc` allows overriding the libc installation. + const libc_installation: ?*const LibCInstallation = lci: { + const paths_file = debug_libc_paths_file orelse break :lci null; + if (!build_options.enable_debug_extensions) unreachable; + const lci = try arena.create(LibCInstallation); + lci.* = try .parse(arena, paths_file, &resolved_target.result); + break :lci lci; + }; process.raiseFileDescriptorLimit(); @@ -5367,6 +5384,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { } const comp = Compilation.create(gpa, arena, .{ + .libc_installation = libc_installation, .dirs = dirs, .root_name = "build", .config = config, |
