| ... | ... | @@ -1112,20 +1112,23 @@ pub fn parseDependentLibs(self: *MachO, dependent_libs: anytype) !void { |
| 1112 | 1112 | |
| 1113 | 1113 | const parent = &self.dylibs.items[dep_id.parent]; |
| 1114 | 1114 | const weak = parent.weak; |
| 1115 | const dirname = fs.path.dirname(dep_id.id.name) orelse ""; |
| 1115 | 1116 | const basename = fs.path.basename(dep_id.id.name); |
| 1116 | 1117 | |
| 1117 | | var test_path = std.ArrayList(u8).init(gpa); |
| 1118 | | defer test_path.deinit(); |
| 1118 | var arena_allocator = std.heap.ArenaAllocator.init(gpa); |
| 1119 | defer arena_allocator.deinit(); |
| 1120 | const arena = arena_allocator.allocator(); |
| 1119 | 1121 | |
| 1120 | | var checked_paths = std.ArrayList([]const u8).init(gpa); |
| 1121 | | defer checked_paths.deinit(); |
| 1122 | var test_path = std.ArrayList(u8).init(arena); |
| 1123 | var checked_paths = std.ArrayList([]const u8).init(arena); |
| 1122 | 1124 | |
| 1123 | 1125 | success: { |
| 1124 | 1126 | if (self.base.options.sysroot) |root| { |
| 1125 | | if (try accessLibPath(gpa, &test_path, &checked_paths, root, basename)) break :success; |
| 1127 | const dir = try fs.path.join(arena, &[_][]const u8{ root, dirname }); |
| 1128 | if (try accessLibPath(gpa, &test_path, &checked_paths, dir, basename)) break :success; |
| 1126 | 1129 | } |
| 1127 | 1130 | |
| 1128 | | if (try accessLibPath(gpa, &test_path, &checked_paths, "", basename)) break :success; |
| 1131 | if (try accessLibPath(gpa, &test_path, &checked_paths, dirname, basename)) break :success; |
| 1129 | 1132 | |
| 1130 | 1133 | try self.reportMissingLibraryError( |
| 1131 | 1134 | checked_paths.items, |