authorgravatar for motiejus@jakstys.ltMotiejus Jakštys <motiejus@jakstys.lt> 2021-12-11 10:40:57+02:00
committergravatar for motiejus@jakstys.ltMotiejus Jakštys <motiejus@jakstys.lt> 2021-12-11 10:40:57+02:00
log82a706934452560e5848527207c6cb476e1f1444
tree44d1679d17e45986d7a2cddc2af7f74ae3e3452d
parent97c0373fa7ee125d2d4e73f9b1dc8ea0e2c2e86a

macho: fail if requested -framework is not found

If `-framework` is requested, but not found, the linker will err instead of creating a strange executable. https://github.com/ziglang/zig/issues/10299#issuecomment-990404953 Refs #9542 Refs #10299 Refs #10158

1 files changed, 7 insertions(+), 9 deletions(-)

src/link/MachO.zig+7-9
......@@ -751,7 +751,6 @@ pub fn flushModule(self: *MachO, comp: *Compilation) !void {
751751 }
752752 }
753753
754 var framework_not_found = false;
755754 for (self.base.options.frameworks) |framework| {
756755 for (&[_][]const u8{ ".tbd", ".dylib", "" }) |ext| {
757756 if (try resolveFramework(arena, framework_dirs.items, framework, ext)) |full_path| {
......@@ -760,14 +759,13 @@ pub fn flushModule(self: *MachO, comp: *Compilation) !void {
760759 }
761760 } else {
762761 log.warn("framework not found for '-framework {s}'", .{framework});
763 framework_not_found = true;
764 }
765 }
766
767 if (framework_not_found) {
768 log.warn("Framework search paths:", .{});
769 for (framework_dirs.items) |dir| {
770 log.warn(" {s}", .{dir});
762 log.warn("Framework search paths:", .{});
763 for (framework_dirs.items) |dir| {
764 log.warn(" {s}", .{dir});
765 } else {
766 log.warn(" <empty>. Consider specifying --sysroot", .{});
767 }
768 return error.FrameworkNotFound;
771769 }
772770 }
773771