Skip to content

Commit

Permalink
macho: fail if requested -framework is not found
Browse files Browse the repository at this point in the history
If `-framework` is requested, but not found, the linker will err
instead of creating a strange executable.

ziglang#10299 (comment)

Refs ziglang#9542
Refs ziglang#10299
Refs ziglang#10158
  • Loading branch information
motiejus committed Dec 11, 2021
1 parent 97c0373 commit 82a7069
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/link/MachO.zig
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,6 @@ pub fn flushModule(self: *MachO, comp: *Compilation) !void {
}
}

var framework_not_found = false;
for (self.base.options.frameworks) |framework| {
for (&[_][]const u8{ ".tbd", ".dylib", "" }) |ext| {
if (try resolveFramework(arena, framework_dirs.items, framework, ext)) |full_path| {
Expand All @@ -760,14 +759,13 @@ pub fn flushModule(self: *MachO, comp: *Compilation) !void {
}
} else {
log.warn("framework not found for '-framework {s}'", .{framework});
framework_not_found = true;
}
}

if (framework_not_found) {
log.warn("Framework search paths:", .{});
for (framework_dirs.items) |dir| {
log.warn(" {s}", .{dir});
log.warn("Framework search paths:", .{});
for (framework_dirs.items) |dir| {
log.warn(" {s}", .{dir});
} else {
log.warn(" <empty>. Consider specifying --sysroot", .{});
}
return error.FrameworkNotFound;
}
}

Expand Down

0 comments on commit 82a7069

Please sign in to comment.