Compile: Pass the default --zig-lib-dir along to child processes

main: print the self_exe_path when `findZigLibDirFromSelfExe` fails in all cases
This commit is contained in:
kcbanner 2024-07-13 19:04:55 -04:00
parent bc28454b43
commit 373e53d7c5
2 changed files with 11 additions and 4 deletions

View file

@ -1635,9 +1635,16 @@ fn getZigArgs(compile: *Compile) ![][]const u8 {
});
}
if (compile.zig_lib_dir) |dir| {
const opt_zig_lib_dir = if (compile.zig_lib_dir) |dir|
dir.getPath2(b, step)
else if (b.graph.zig_lib_directory.path) |_|
b.fmt("{}", .{b.graph.zig_lib_directory})
else
null;
if (opt_zig_lib_dir) |zig_lib_dir| {
try zig_args.append("--zig-lib-dir");
try zig_args.append(dir.getPath2(b, step));
try zig_args.append(zig_lib_dir);
}
try addFlag(&zig_args, "PIE", compile.pie);

View file

@ -2710,7 +2710,7 @@ fn buildOutputType(
break :d getWasiPreopen("/lib");
} else if (self_exe_path) |p| {
break :d introspect.findZigLibDirFromSelfExe(arena, p) catch |err| {
fatal("unable to find zig installation directory: {s}", .{@errorName(err)});
fatal("unable to find zig installation directory '{s}': {s}", .{ p, @errorName(err) });
};
} else {
unreachable;
@ -7403,7 +7403,7 @@ fn findTemplates(gpa: Allocator, arena: Allocator) Templates {
fatal("unable to find self exe path: {s}", .{@errorName(err)});
};
var zig_lib_directory = introspect.findZigLibDirFromSelfExe(arena, self_exe_path) catch |err| {
fatal("unable to find zig installation directory: {s}", .{@errorName(err)});
fatal("unable to find zig installation directory '{s}': {s}", .{ self_exe_path, @errorName(err) });
};
const s = fs.path.sep_str;