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 {...@@ -751,7 +751,6 @@ pub fn flushModule(self: *MachO, comp: *Compilation) !void {
751 }751 }
752 }752 }
753753
754 var framework_not_found = false;
755 for (self.base.options.frameworks) |framework| {754 for (self.base.options.frameworks) |framework| {
756 for (&[_][]const u8{ ".tbd", ".dylib", "" }) |ext| {755 for (&[_][]const u8{ ".tbd", ".dylib", "" }) |ext| {
757 if (try resolveFramework(arena, framework_dirs.items, framework, ext)) |full_path| {756 if (try resolveFramework(arena, framework_dirs.items, framework, ext)) |full_path| {
...@@ -760,14 +759,13 @@ pub fn flushModule(self: *MachO, comp: *Compilation) !void {...@@ -760,14 +759,13 @@ pub fn flushModule(self: *MachO, comp: *Compilation) !void {
760 }759 }
761 } else {760 } else {
762 log.warn("framework not found for '-framework {s}'", .{framework});761 log.warn("framework not found for '-framework {s}'", .{framework});
763 framework_not_found = true;762 log.warn("Framework search paths:", .{});
764 }763 for (framework_dirs.items) |dir| {
765 }764 log.warn(" {s}", .{dir});
766765 } else {
767 if (framework_not_found) {766 log.warn(" <empty>. Consider specifying --sysroot", .{});
768 log.warn("Framework search paths:", .{});767 }
769 for (framework_dirs.items) |dir| {768 return error.FrameworkNotFound;
770 log.warn(" {s}", .{dir});
771 }769 }
772 }770 }
773771