Commit 0c8bf405eb
Changed files (2)
src
link
src/link/MachO/load_commands.zig
@@ -474,7 +474,7 @@ pub fn inferSdkVersion(gpa: Allocator, comp: *const Compilation) ?std.SemanticVe
const options = comp.bin_file.options;
- const sdk_layout = options.darwin_sdk_layout.?;
+ const sdk_layout = options.darwin_sdk_layout orelse return null;
const sdk_dir = switch (sdk_layout) {
.sdk => options.sysroot.?,
.vendored => std.fs.path.join(arena, &.{ comp.zig_lib_directory.path.?, "libc", "darwin" }) catch return null,
@@ -482,7 +482,7 @@ pub fn inferSdkVersion(gpa: Allocator, comp: *const Compilation) ?std.SemanticVe
if (readSdkVersionFromSettings(arena, sdk_dir)) |ver| {
return parseSdkVersion(ver);
} else |_| {
- // We control vendored and reading settings should always succeed.
+ // Read from settings should always succeed when vendored.
if (sdk_layout == .vendored) @panic("zig installation bug: unable to parse SDK version");
}
src/link/MachO.zig
@@ -652,7 +652,7 @@ pub fn resolveLibSystem(
"libSystem",
)) break :success;
- switch (self.base.options.darwin_sdk_layout.?) {
+ if (self.base.options.darwin_sdk_layout) |sdk_layout| switch (sdk_layout) {
.sdk => {
const dir = try fs.path.join(tmp_arena, &[_][]const u8{ self.base.options.sysroot.?, "usr", "lib" });
if (try accessLibPath(tmp_arena, &test_path, &checked_paths, dir, "libSystem")) break :success;
@@ -661,7 +661,7 @@ pub fn resolveLibSystem(
const dir = try comp.zig_lib_directory.join(tmp_arena, &[_][]const u8{ "libc", "darwin" });
if (try accessLibPath(tmp_arena, &test_path, &checked_paths, dir, "libSystem")) break :success;
},
- }
+ };
try self.reportMissingLibraryError(checked_paths.items, "unable to find libSystem system library", .{});
return;