aboutsummaryrefslogtreecommitdiff
path: root/lib/compiler
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2025-08-13 13:01:20 +0100
committerMatthew Lugg <mlugg@mlugg.co.uk>2025-08-13 23:50:57 +0100
commite304a478c0654e8a6c506eedbd5556f99ac79d6c (patch)
tree0d4e414134e438b156b67d62ae5b87a9b6e2f287 /lib/compiler
parent4f639ff8805b33fa6c75416eddfb205e3a04e09a (diff)
downloadzig-e304a478c0654e8a6c506eedbd5556f99ac79d6c.tar.gz
zig-e304a478c0654e8a6c506eedbd5556f99ac79d6c.zip
build runner: fix single-threaded build
Resolves: #24723
Diffstat (limited to 'lib/compiler')
-rw-r--r--lib/compiler/build_runner.zig32
1 files changed, 18 insertions, 14 deletions
diff --git a/lib/compiler/build_runner.zig b/lib/compiler/build_runner.zig
index 7e1286958a..41315457c1 100644
--- a/lib/compiler/build_runner.zig
+++ b/lib/compiler/build_runner.zig
@@ -340,9 +340,10 @@ pub fn main() !void {
}
}
- if (webui_listen != null and watch) fatal(
- \\the build system does not yet support combining '--webui' and '--watch'; consider omitting '--watch' in favour of the web UI "Rebuild" button
- , .{});
+ if (webui_listen != null) {
+ if (watch) fatal("using '--webui' and '--watch' together is not yet supported; consider omitting '--watch' in favour of the web UI \"Rebuild\" button", .{});
+ if (builtin.single_threaded) fatal("'--webui' is not yet supported on single-threaded hosts", .{});
+ }
const stderr: std.fs.File = .stderr();
const ttyconf = get_tty_conf(color, stderr);
@@ -449,16 +450,19 @@ pub fn main() !void {
try run.thread_pool.init(thread_pool_options);
defer run.thread_pool.deinit();
- run.web_server = if (webui_listen) |listen_address| .init(.{
- .gpa = gpa,
- .thread_pool = &run.thread_pool,
- .graph = &graph,
- .all_steps = run.step_stack.keys(),
- .ttyconf = run.ttyconf,
- .root_prog_node = main_progress_node,
- .watch = watch,
- .listen_address = listen_address,
- }) else null;
+ run.web_server = if (webui_listen) |listen_address| ws: {
+ if (builtin.single_threaded) unreachable; // `fatal` above
+ break :ws .init(.{
+ .gpa = gpa,
+ .thread_pool = &run.thread_pool,
+ .graph = &graph,
+ .all_steps = run.step_stack.keys(),
+ .ttyconf = run.ttyconf,
+ .root_prog_node = main_progress_node,
+ .watch = watch,
+ .listen_address = listen_address,
+ });
+ } else null;
if (run.web_server) |*ws| {
ws.start() catch |err| fatal("failed to start web server: {s}", .{@errorName(err)});
@@ -562,7 +566,7 @@ const Run = struct {
max_rss_mutex: std.Thread.Mutex,
skip_oom_steps: bool,
watch: bool,
- web_server: ?WebServer,
+ web_server: if (!builtin.single_threaded) ?WebServer else ?noreturn,
/// Allocated into `gpa`.
memory_blocked_steps: std.ArrayListUnmanaged(*Step),
/// Allocated into `gpa`.