authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-10-12 17:45:44-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-10-12 17:45:44-07:00
logc8160b8a2ecd8ebf23e6e26a5dbb4dd6f3e60ffc
treefbef701cc261d1908fc2cf5dac2a2c3002c0b86c
parent9276a56e3cee12a067f93d719a5e7f2762dd4603

Maker: --help works even when configuration fails


2 files changed, 196 insertions(+), 154 deletions(-)

lib/compiler/Maker.zig+60-35
......@@ -23,6 +23,7 @@ const Color = std.zig.Color;
2323const Client = std.zig.Client;
2424const Server = std.zig.Server;
2525const EnvVar = std.zig.EnvVar;
26const ErrorBundle = std.zig.ErrorBundle;
2627const default_local_zig_cache_basename = std.zig.default_local_zig_cache_basename;
2728const stringToEnum = std.meta.stringToEnum;
2829
......@@ -35,6 +36,7 @@ const ScannedConfig = @import("Maker/ScannedConfig.zig");
3536const PkgConfig = @import("Maker/PkgConfig.zig");
3637const Fetch = @import("Maker/Fetch.zig");
3738const Package = @import("Maker/Package.zig");
39const Manifest = Package.Manifest;
3840
3941pub const std_options: std.Options = .{
4042 .side_channels_mitigations = .none,
......@@ -601,10 +603,16 @@ pub fn main(init: process.Init.Minimal) !void {
601603 const cwd_path = std.zig.getResolvedCwd(io, arena) catch |err|
602604 fatal("resolving current directory path failed: {t}", .{err});
603605
604 var build_root = try findBuildRoot(arena, io, .{
606 var build_root = findBuildRoot(arena, io, .{
605607 .cwd_path = cwd_path,
606608 .build_file = build_file,
607 });
609 }) catch |err| switch (err) {
610 error.BuildZigNotFound => {
611 if (help_menu) printUsageWithoutConfiguration(&graph, "build.zig not found");
612 process.exit(1);
613 },
614 else => |e| return e,
615 };
608616 defer build_root.deinit(io);
609617
610618 graph.build_root_directory = build_root.directory;
......@@ -740,7 +748,7 @@ pub fn main(init: process.Init.Minimal) !void {
740748 var configure_source_files: Cache.Manifest.SelfContainedFiles = .empty;
741749 defer configure_source_files.deinit(gpa);
742750
743 var configure_error_bundle: std.zig.ErrorBundle = .empty;
751 var configure_error_bundle: ErrorBundle = .empty;
744752 defer configure_error_bundle.deinit(gpa);
745753
746754 // If this fails, we can still start the server and wait for user
......@@ -1042,7 +1050,10 @@ pub fn main(init: process.Init.Minimal) !void {
10421050 } else |err| {
10431051 const can_fs_watch = switch (err) {
10441052 error.AlreadyReported => false,
1045 error.FailedButCacheIntact => true,
1053 error.FailedButCacheIntact => c: {
1054 if (help_menu) printUsageWithoutConfiguration(&graph, "build.zig compilation failure");
1055 break :c true;
1056 },
10461057 else => |e| w: {
10471058 log.err("configuration failed: {t}", .{e});
10481059 break :w false;
......@@ -1064,6 +1075,17 @@ pub fn main(init: process.Init.Minimal) !void {
10641075 }
10651076}
10661077
1078fn printUsageWithoutConfiguration(graph: *Graph, reason: []const u8) noreturn {
1079 const io = graph.io;
1080 _ = io.lockStderr(&.{}, graph.stderr_mode) catch {};
1081 const writer = initStdoutWriter(io);
1082 ScannedConfig.printUsageWithoutConfiguration(graph.zig_exe, writer, reason) catch |err| switch (err) {
1083 error.WriteFailed => fatal("failed writing to stdout: {t}", .{stdout_writer_allocation.err.?}),
1084 };
1085 stdout_writer_allocation.flush() catch |err| fatal("failed writing to stdout: {t}", .{err});
1086 return process.exit(0);
1087}
1088
10671089/// Temporarily adds the reconfigure pseudostep to step_stack, calls
10681090/// `Watch.update`, and then pops it again.
10691091fn updateWatch(maker: *Maker, watch: *Watch) !void {
......@@ -1091,7 +1113,7 @@ const ConfigureOptions = struct {
10911113 print_configuration: PrintConfiguration,
10921114 forks: []Fork,
10931115 src_files: *Cache.Manifest.SelfContainedFiles,
1094 error_bundle: ?*std.zig.ErrorBundle = null,
1116 error_bundle: ?*ErrorBundle = null,
10951117};
10961118
10971119fn configure(graph: *Graph, options: ConfigureOptions) !ScannedConfig {
......@@ -1402,7 +1424,7 @@ fn configure(graph: *Graph, options: ConfigureOptions) !ScannedConfig {
14021424 for (fetches) |f| {
14031425 if (!f.have_manifest) continue;
14041426 if (config_man) |man| {
1405 const manifest_path = try f.package_root.join(arena, Package.Manifest.basename);
1427 const manifest_path = try f.package_root.join(arena, Manifest.basename);
14061428 _ = try man.addInputPath(manifest_path, .{});
14071429 }
14081430 const mod = f.cli_module orelse continue;
......@@ -1932,8 +1954,8 @@ fn cmdFetch(gpa: Allocator, graph: *Graph, args: []const []const u8) !void {
19321954 try ast.render(gpa, &aw.writer, fixups);
19331955 const rendered = aw.written();
19341956
1935 build_root.directory.handle.writeFile(io, .{ .sub_path = Package.Manifest.basename, .data = rendered }) catch |err| {
1936 fatal("unable to write {s} file: {t}", .{ Package.Manifest.basename, err });
1957 build_root.directory.handle.writeFile(io, .{ .sub_path = Manifest.basename, .data = rendered }) catch |err| {
1958 fatal("unable to write {s} file: {t}", .{ Manifest.basename, err });
19371959 };
19381960
19391961 return process.cleanExit(io);
......@@ -2135,7 +2157,7 @@ fn cmdInit(gpa: Allocator, graph: *Graph, args: []const []const u8) !void {
21352157 const s = Dir.path.sep_str;
21362158 const template_paths = [_][]const u8{
21372159 default_build_zig_basename,
2138 Package.Manifest.basename,
2160 Manifest.basename,
21392161 "src" ++ s ++ "main.zig",
21402162 "src" ++ s ++ "root.zig",
21412163 };
......@@ -2159,7 +2181,7 @@ fn cmdInit(gpa: Allocator, graph: *Graph, args: []const []const u8) !void {
21592181 return process.cleanExit(io);
21602182 },
21612183 .minimal => {
2162 Templates.writeSimpleFile(io, Io.Dir.cwd(), Package.Manifest.basename,
2184 Templates.writeSimpleFile(io, Io.Dir.cwd(), Manifest.basename,
21632185 \\.{{
21642186 \\ .name = .{s},
21652187 \\ .version = "0.0.1",
......@@ -2173,8 +2195,8 @@ fn cmdInit(gpa: Allocator, graph: *Graph, args: []const []const u8) !void {
21732195 builtin.zig_version_string,
21742196 fingerprint.int(),
21752197 }) catch |err| switch (err) {
2176 else => fatal("failed to create {q}: {t}", .{ Package.Manifest.basename, err }),
2177 error.PathAlreadyExists => fatal("refusing to overwrite {q}", .{Package.Manifest.basename}),
2198 else => fatal("failed to create {q}: {t}", .{ Manifest.basename, err }),
2199 error.PathAlreadyExists => fatal("refusing to overwrite {q}", .{Manifest.basename}),
21782200 };
21792201 Templates.writeSimpleFile(io, Io.Dir.cwd(), default_build_zig_basename,
21802202 \\const std = @import("std");
......@@ -2189,12 +2211,12 @@ fn cmdInit(gpa: Allocator, graph: *Graph, args: []const []const u8) !void {
21892211 // their `build.zig.zon` *after* writing their `build.zig`. So this one isn't fatal.
21902212 error.PathAlreadyExists => {
21912213 log.info("successfully populated {q}, preserving existing {q}", .{
2192 Package.Manifest.basename, default_build_zig_basename,
2214 Manifest.basename, default_build_zig_basename,
21932215 });
21942216 return process.cleanExit(io);
21952217 },
21962218 };
2197 log.info("successfully populated {q} and {q}", .{ Package.Manifest.basename, default_build_zig_basename });
2219 log.info("successfully populated {q} and {q}", .{ Manifest.basename, default_build_zig_basename });
21982220 return process.cleanExit(io);
21992221 },
22002222 }
......@@ -3277,7 +3299,7 @@ pub fn invalidateResult(maker: *Maker, step: *Step) error{MustReconfigure}!bool
32773299pub fn printErrorMessages(
32783300 maker: *Maker,
32793301 failing_step_index: Configuration.Step.Index,
3280 options: std.zig.ErrorBundle.RenderOptions,
3302 options: ErrorBundle.RenderOptions,
32813303 stderr: Io.Terminal,
32823304 error_style: ErrorStyle,
32833305 multiline_errors: MultilineErrors,
......@@ -4037,7 +4059,9 @@ const FindBuildRootOptions = struct {
40374059 cwd_path: []const u8,
40384060};
40394061
4040fn findBuildRoot(arena: Allocator, io: Io, options: FindBuildRootOptions) !BuildRoot {
4062const FindBuildRootError = error{ OutOfMemory, BuildZigNotFound };
4063
4064fn findBuildRoot(arena: Allocator, io: Io, options: FindBuildRootOptions) FindBuildRootError!BuildRoot {
40414065 const build_zig_basename = if (options.build_file) |bf|
40424066 Dir.path.basename(bf)
40434067 else
......@@ -4088,11 +4112,12 @@ fn findBuildRoot(arena: Allocator, io: Io, options: FindBuildRootOptions) !Build
40884112 dirname = Dir.path.dirname(dirname orelse options.cwd_path) orelse {
40894113 log.info("initialize {s} template file with \"zig init\"", .{std.zig.build_zig_basename});
40904114 log.info("see \"zig --help\" for more options", .{});
4091 fatal("no build.zig file found, in the current directory or any parent directories", .{});
4115 log.err("no build.zig file found, in the current directory or any parent directories", .{});
4116 return error.BuildZigNotFound;
40924117 };
40934118 continue;
40944119 },
4095 else => |e| return e,
4120 else => |e| fatal("accessing {q} while searching for build.zig file failed: {t}", .{ joined_path, e }),
40964121 }
40974122 }
40984123}
......@@ -4100,8 +4125,8 @@ fn findBuildRoot(arena: Allocator, io: Io, options: FindBuildRootOptions) !Build
41004125const Fork = struct {
41014126 path: Path,
41024127 manifest_ast: std.zig.Ast,
4103 manifest: Package.Manifest,
4104 error_bundle: std.zig.ErrorBundle.Wip,
4128 manifest: Manifest,
4129 error_bundle: ErrorBundle.Wip,
41054130 failed: bool,
41064131 arena_allocator: std.heap.ArenaAllocator,
41074132
......@@ -4134,12 +4159,12 @@ const Fork = struct {
41344159 fork.arena_allocator = .init(gpa);
41354160 const arena = fork.arena_allocator.allocator();
41364161
4137 var error_bundle: std.zig.ErrorBundle.Wip = try .init(gpa);
4162 var error_bundle: ErrorBundle.Wip = try .init(gpa);
41384163 defer error_bundle.deinit();
41394164
4140 const manifest_path = try fork.path.join(arena, Package.Manifest.basename);
4165 const manifest_path = try fork.path.join(arena, Manifest.basename);
41414166
4142 Package.Manifest.load(
4167 Manifest.load(
41434168 io,
41444169 arena,
41454170 manifest_path,
......@@ -4189,20 +4214,20 @@ fn loadManifest(
41894214 arena: Allocator,
41904215 io: Io,
41914216 options: LoadManifestOptions,
4192) !struct { Package.Manifest, std.zig.Ast } {
4217) !struct { Manifest, std.zig.Ast } {
41934218 const rng: std.Random.IoSource = .{ .io = io };
41944219
41954220 const manifest_bytes = while (true) {
41964221 break options.dir.readFileAllocOptions(
41974222 io,
4198 Package.Manifest.basename,
4223 Manifest.basename,
41994224 arena,
4200 .limited(Package.Manifest.max_bytes),
4225 .limited(Manifest.max_bytes),
42014226 .@"1",
42024227 0,
42034228 ) catch |err| switch (err) {
42044229 error.FileNotFound => {
4205 Templates.writeSimpleFile(io, options.dir, Package.Manifest.basename,
4230 Templates.writeSimpleFile(io, options.dir, Manifest.basename,
42064231 \\.{{
42074232 \\ .name = .{s},
42084233 \\ .version = "0.0.1",
......@@ -4216,29 +4241,29 @@ fn loadManifest(
42164241 builtin.zig_version_string,
42174242 Package.Fingerprint.generate(rng.interface(), options.root_name).int(),
42184243 }) catch |e| {
4219 fatal("unable to write {s}: {t}", .{ Package.Manifest.basename, e });
4244 fatal("unable to write {s}: {t}", .{ Manifest.basename, e });
42204245 };
42214246 continue;
42224247 },
4223 else => |e| fatal("unable to load {s}: {t}", .{ Package.Manifest.basename, e }),
4248 else => |e| fatal("unable to load {s}: {t}", .{ Manifest.basename, e }),
42244249 };
42254250 };
42264251 var ast = try std.zig.Ast.parse(gpa, manifest_bytes, .{ .mode = .zon });
42274252 errdefer ast.deinit(gpa);
42284253
42294254 if (ast.errors.len > 0) {
4230 try std.zig.printAstErrorsToStderr(gpa, io, ast, Package.Manifest.basename, options.color);
4255 try std.zig.printAstErrorsToStderr(gpa, io, ast, Manifest.basename, options.color);
42314256 process.exit(2);
42324257 }
42334258
4234 var manifest = try Package.Manifest.parse(gpa, &ast, rng.interface(), .{});
4259 var manifest = try Manifest.parse(gpa, &ast, rng.interface(), .{});
42354260 errdefer manifest.deinit(gpa);
42364261
42374262 if (manifest.errors.len > 0) {
4238 var wip_errors: std.zig.ErrorBundle.Wip = try .init(gpa);
4263 var wip_errors: ErrorBundle.Wip = try .init(gpa);
42394264 defer wip_errors.deinit();
42404265
4241 const src_path = try wip_errors.addString(Package.Manifest.basename);
4266 const src_path = try wip_errors.addString(Manifest.basename);
42424267 try manifest.copyErrorsIntoBundle(ast, src_path, &wip_errors);
42434268
42444269 var error_bundle = try wip_errors.toOwnedBundle("");
......@@ -4262,8 +4287,8 @@ fn sanitizeExampleName(arena: Allocator, bytes: []const u8) error{OutOfMemory}![
42624287 else => continue,
42634288 };
42644289 if (!std.zig.isValidId(result.items)) return "foo";
4265 if (result.items.len > Package.Manifest.max_name_len)
4266 result.shrinkRetainingCapacity(Package.Manifest.max_name_len);
4290 if (result.items.len > Manifest.max_name_len)
4291 result.shrinkRetainingCapacity(Manifest.max_name_len);
42674292
42684293 return result.toOwnedSlice(arena);
42694294}
lib/compiler/Maker/ScannedConfig.zig+136-119
......@@ -238,6 +238,18 @@ pub fn printSteps(sc: *const ScannedConfig, graph: *Graph, w: *Writer) !void {
238238 }
239239}
240240
241pub fn printUsageWithoutConfiguration(zig_exe: []const u8, w: *Writer, reason: []const u8) Writer.Error!void {
242 try w.print(
243 \\Usage: {s} build [steps] [options]
244 \\
245 \\Steps: (unavailable due to {s})
246 \\Project-Specific Options: (unavailable due to {s})
247 \\{s}
248 \\ (unavailable due to {s})
249 \\{s}
250 , .{ zig_exe, reason, reason, system_integration_usage, reason, general_usage });
251}
252
241253pub fn printUsage(sc: *const ScannedConfig, graph: *Graph, w: *Writer) !void {
242254 const arena = graph.arena;
243255
......@@ -274,37 +286,7 @@ pub fn printUsage(sc: *const ScannedConfig, graph: *Graph, w: *Writer) !void {
274286 }
275287 }
276288
277 try w.writeAll(
278 \\
279 \\System Integration Options:
280 \\ --search-prefix [path] Add a path to look for binaries, libraries, headers
281 \\ --sysroot [path] Set the system root directory (usually /)
282 \\ --libc [file] Provide a file which specifies libc paths
283 \\
284 \\ --system [pkgdir] Disable package fetching; enable all integrations
285 \\ -fsys=[name] Enable a system integration
286 \\ -fno-sys=[name] Disable a system integration
287 \\
288 \\ -fdarling, -fno-darling Integration with system-installed Darling to
289 \\ execute macOS programs on Linux hosts
290 \\ (default: no)
291 \\ -fqemu, -fno-qemu Integration with system-installed QEMU to execute
292 \\ foreign-architecture programs on Linux hosts
293 \\ (default: no)
294 \\ --libc-runtimes [path] Enhances QEMU integration by providing dynamic libc
295 \\ (e.g. glibc or musl) built for multiple foreign
296 \\ architectures, allowing execution of non-native
297 \\ programs that link with libc.
298 \\ -frosetta, -fno-rosetta Rely on Rosetta to execute x86_64 programs on
299 \\ ARM64 macOS hosts. (default: no)
300 \\ -fwasmtime, -fno-wasmtime Integration with system-installed wasmtime to
301 \\ execute WASI binaries. (default: no)
302 \\ -fwine, -fno-wine Integration with system-installed Wine to execute
303 \\ Windows programs on Linux hosts. (default: no)
304 \\
305 \\ Available System Integrations: Enabled:
306 \\
307 );
289 try w.writeAll(system_integration_usage);
308290 if (sc.configuration.system_integrations.len == 0) {
309291 try w.writeAll(" (none) -\n");
310292 } else {
......@@ -318,92 +300,127 @@ pub fn printUsage(sc: *const ScannedConfig, graph: *Graph, w: *Writer) !void {
318300 }
319301 }
320302
321 try w.writeAll(
322 \\
323 \\General Options:
324 \\ -h, --help Print this help to stdout and exit
325 \\ -l, --list-steps Print available steps to stdout and exit
326 \\
327 \\ -p, --prefix [path] Where to install files (default: zig-out)
328 \\ --prefix-lib-dir [path] Where to install libraries
329 \\ --prefix-exe-dir [path] Where to install executables
330 \\ --prefix-include-dir [path] Where to install C header files
331 \\ --release[=mode] Request release mode, optionally specifying a
332 \\ preferred optimization mode: fast, safe, small
333 \\
334 \\ --verbose Print commands before executing them
335 \\ --color [auto|off|on] Enable or disable colored error messages
336 \\ --error-style [style] Control how build errors are printed
337 \\ verbose (Default) Report errors with full context
338 \\ minimal Report errors after summary, excluding context like command lines
339 \\ verbose_clear Like 'verbose', but clear the terminal at the start of each update
340 \\ minimal_clear Like 'minimal', but clear the terminal at the start of each update
341 \\ --multiline-errors [style] Control how multi-line error messages are printed
342 \\ indent (Default) Indent non-initial lines to align with initial line
343 \\ newline Include a leading newline so that the error message is on its own lines
344 \\ none Print as usual so the first line is misaligned
345 \\ --summary [mode] Control the printing of the build summary
346 \\ all Print the build summary in its entirety
347 \\ new Omit cached steps
348 \\ failures (Default if short-lived) Only print failed steps
349 \\ line (Default if long-lived) Only print the single-line summary
350 \\ none Do not print the build summary
351 \\ -j<N> Limit concurrent jobs (default is to use all CPU cores)
352 \\ --maxrss <bytes> Limit memory usage (default is to use available memory)
353 \\ --skip-oom-steps Instead of failing, skip steps that would exceed --maxrss
354 \\ --test-timeout <timeout> Limit execution time of unit tests, terminating if exceeded.
355 \\ The timeout must include a unit: ns, us, ms, s, m, h
356 \\ --watch Continuously rebuild when source files are modified
357 \\ --debounce <ms> Delay before rebuilding after changed file detected
358 \\ --webui[=ip] Enable the web interface on the given IP address
359 \\ --fuzz[=limit] Continuously search for unit test failures with an optional
360 \\ limit to the max number of iterations. The argument supports
361 \\ an optional 'K', 'M', or 'G' suffix (e.g. '10K'). Implies
362 \\ '--webui' when no limit is specified.
363 \\ --listen=- Enable the build server protocol on stdio
364 \\ --time-report Force full rebuild and provide detailed information on
365 \\ compilation time of Zig source code (implies '--webui')
366 \\ -fincremental Enable incremental compilation
367 \\ -fno-incremental Disable incremental compilation
368 \\
369 \\Package Management Options:
370 \\ --fetch[=mode] Fetch dependency tree (optionally choose laziness) and exit
371 \\ needed (Default) Lazy dependencies are fetched as needed
372 \\ all Lazy dependencies are always fetched
373 \\ --fork=[path], --fork [path] Override one or more projects from dependency tree
374 \\
375 \\Advanced Options:
376 \\ -freference-trace[=num] How many lines of reference trace should be shown per compile error
377 \\ -fno-reference-trace Disable reference trace
378 \\ -fallow-so-scripts Allows .so files to be GNU ld scripts
379 \\ -fno-allow-so-scripts (default) .so files must be ELF files
380 \\ --error-limit [num] Set the maximum amount of distinct error values
381 \\ --build-file [file] Override path to build.zig
382 \\ --cache-dir [path] Override path to local Zig cache directory
383 \\ --zig-lib=[arg] Override path to Zig lib directory
384 \\ --seed [integer] For shuffling dependency traversal order (default: random)
385 \\ --cache-poison[=mode] Override configuration caching behavior
386 \\ pure (default) Avoid false positive cache hits
387 \\ poisoned Don't cache the configuration
388 \\ disallowed Panics when cache would be poisoned
389 \\ ignored A little poison never hurt anybody
390 \\ --print-configuration Render configuration as .zon to stdout
391 \\ --print-configuration-path Print the path to the binary configuration file to stdout
392 \\ --build-id[=style] At a minor link-time expense, embeds a build ID in binaries
393 \\ fast 8-byte non-cryptographic hash (COFF, ELF, WASM)
394 \\ sha1, tree 20-byte cryptographic hash (ELF, WASM)
395 \\ md5 16-byte cryptographic hash (ELF)
396 \\ uuid 16-byte random UUID (ELF, WASM)
397 \\ 0x[hexstring] Constant ID, maximum 32 bytes (ELF, WASM)
398 \\ none (default) No build ID
399 \\ --debug-log [scope] Enable debugging the compiler
400 \\ --debug-pkg-config Fail if unknown pkg-config flags encountered
401 \\ --verbose-link Enable compiler debug output for linking
402 \\ --verbose-air Enable compiler debug output for Zig AIR
403 \\ --verbose-llvm-ir Enable compiler debug output for LLVM IR
404 \\ --verbose-cimport Enable compiler debug output for C imports
405 \\ --verbose-cc Enable compiler debug output for C compilation
406 \\ --verbose-llvm-cpu-features Enable compiler debug output for LLVM CPU features
407 \\
408 );
303 try w.writeAll(general_usage);
304}
305
306const system_integration_usage =
307 \\
308 \\System Integration Options:
309 \\ --search-prefix [path] Add a path to look for binaries, libraries, headers
310 \\ --sysroot [path] Set the system root directory (usually /)
311 \\ --libc [file] Provide a file which specifies libc paths
312 \\
313 \\ --system [pkgdir] Disable package fetching; enable all integrations
314 \\ -fsys=[name] Enable a system integration
315 \\ -fno-sys=[name] Disable a system integration
316 \\
317 \\ -fdarling, -fno-darling Integration with system-installed Darling to
318 \\ execute macOS programs on Linux hosts
319 \\ (default: no)
320 \\ -fqemu, -fno-qemu Integration with system-installed QEMU to execute
321 \\ foreign-architecture programs on Linux hosts
322 \\ (default: no)
323 \\ --libc-runtimes [path] Enhances QEMU integration by providing dynamic libc
324 \\ (e.g. glibc or musl) built for multiple foreign
325 \\ architectures, allowing execution of non-native
326 \\ programs that link with libc.
327 \\ -frosetta, -fno-rosetta Rely on Rosetta to execute x86_64 programs on
328 \\ ARM64 macOS hosts. (default: no)
329 \\ -fwasmtime, -fno-wasmtime Integration with system-installed wasmtime to
330 \\ execute WASI binaries. (default: no)
331 \\ -fwine, -fno-wine Integration with system-installed Wine to execute
332 \\ Windows programs on Linux hosts. (default: no)
333 \\
334 \\ Available System Integrations: Enabled:
335 \\
336;
337
338const general_usage =
339 \\
340 \\General Options:
341 \\ -h, --help Print this help to stdout and exit
342 \\ -l, --list-steps Print available steps to stdout and exit
343 \\
344 \\ -p, --prefix [path] Where to install files (default: zig-out)
345 \\ --prefix-lib-dir [path] Where to install libraries
346 \\ --prefix-exe-dir [path] Where to install executables
347 \\ --prefix-include-dir [path] Where to install C header files
348 \\ --release[=mode] Request release mode, optionally specifying a
349 \\ preferred optimization mode: fast, safe, small
350 \\
351 \\ --verbose Print commands before executing them
352 \\ --color [auto|off|on] Enable or disable colored error messages
353 \\ --error-style [style] Control how build errors are printed
354 \\ verbose (Default) Report errors with full context
355 \\ minimal Report errors after summary, excluding context like command lines
356 \\ verbose_clear Like 'verbose', but clear the terminal at the start of each update
357 \\ minimal_clear Like 'minimal', but clear the terminal at the start of each update
358 \\ --multiline-errors [style] Control how multi-line error messages are printed
359 \\ indent (Default) Indent non-initial lines to align with initial line
360 \\ newline Include a leading newline so that the error message is on its own lines
361 \\ none Print as usual so the first line is misaligned
362 \\ --summary [mode] Control the printing of the build summary
363 \\ all Print the build summary in its entirety
364 \\ new Omit cached steps
365 \\ failures (Default if short-lived) Only print failed steps
366 \\ line (Default if long-lived) Only print the single-line summary
367 \\ none Do not print the build summary
368 \\ -j<N> Limit concurrent jobs (default is to use all CPU cores)
369 \\ --maxrss <bytes> Limit memory usage (default is to use available memory)
370 \\ --skip-oom-steps Instead of failing, skip steps that would exceed --maxrss
371 \\ --test-timeout <timeout> Limit execution time of unit tests, terminating if exceeded.
372 \\ The timeout must include a unit: ns, us, ms, s, m, h
373 \\ --watch Continuously rebuild when source files are modified
374 \\ --debounce <ms> Delay before rebuilding after changed file detected
375 \\ --webui[=ip] Enable the web interface on the given IP address
376 \\ --fuzz[=limit] Continuously search for unit test failures with an optional
377 \\ limit to the max number of iterations. The argument supports
378 \\ an optional 'K', 'M', or 'G' suffix (e.g. '10K'). Implies
379 \\ '--webui' when no limit is specified.
380 \\ --listen=- Enable the build server protocol on stdio
381 \\ --time-report Force full rebuild and provide detailed information on
382 \\ compilation time of Zig source code (implies '--webui')
383 \\ -fincremental Enable incremental compilation
384 \\ -fno-incremental Disable incremental compilation
385 \\
386 \\Package Management Options:
387 \\ --fetch[=mode] Fetch dependency tree (optionally choose laziness) and exit
388 \\ needed (Default) Lazy dependencies are fetched as needed
389 \\ all Lazy dependencies are always fetched
390 \\ --fork=[path], --fork [path] Override one or more projects from dependency tree
391 \\
392 \\Advanced Options:
393 \\ -freference-trace[=num] How many lines of reference trace should be shown per compile error
394 \\ -fno-reference-trace Disable reference trace
395 \\ -fallow-so-scripts Allows .so files to be GNU ld scripts
396 \\ -fno-allow-so-scripts (default) .so files must be ELF files
397 \\ --error-limit [num] Set the maximum amount of distinct error values
398 \\ --build-file [file] Override path to build.zig
399 \\ --cache-dir [path] Override path to local Zig cache directory
400 \\ --zig-lib=[arg] Override path to Zig lib directory
401 \\ --seed [integer] For shuffling dependency traversal order (default: random)
402 \\ --cache-poison[=mode] Override configuration caching behavior
403 \\ pure (default) Avoid false positive cache hits
404 \\ poisoned Don't cache the configuration
405 \\ disallowed Panics when cache would be poisoned
406 \\ ignored A little poison never hurt anybody
407 \\ --print-configuration Render configuration as .zon to stdout
408 \\ --print-configuration-path Print the path to the binary configuration file to stdout
409 \\ --build-id[=style] At a minor link-time expense, embeds a build ID in binaries
410 \\ fast 8-byte non-cryptographic hash (COFF, ELF, WASM)
411 \\ sha1, tree 20-byte cryptographic hash (ELF, WASM)
412 \\ md5 16-byte cryptographic hash (ELF)
413 \\ uuid 16-byte random UUID (ELF, WASM)
414 \\ 0x[hexstring] Constant ID, maximum 32 bytes (ELF, WASM)
415 \\ none (default) No build ID
416 \\ --debug-log [scope] Enable debugging the compiler
417 \\ --debug-pkg-config Fail if unknown pkg-config flags encountered
418 \\ --verbose-link Enable compiler debug output for linking
419 \\ --verbose-air Enable compiler debug output for Zig AIR
420 \\ --verbose-llvm-ir Enable compiler debug output for LLVM IR
421 \\ --verbose-cimport Enable compiler debug output for C imports
422 \\ --verbose-cc Enable compiler debug output for C compilation
423 \\ --verbose-llvm-cpu-features Enable compiler debug output for LLVM CPU features
424 \\
425;
409426}