authorgravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2025-09-04 23:09:09+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-09-19 16:39:00+02:00
logbc921fec122f4fa9e9a3957657c6ee74d6870f5b
tree0b080e128488a23ea96cb585951489b990622083
parent97df4ae3ce34ae2f1ac8298a99faaf990e22ca75

Fix duplicate LC_RPATH entries on macOS Tahoe

When building on macOS Tahoe, binaries were getting duplicate LC_RPATH load commands which caused dyld to refuse to run them with a "duplicate LC_RPATH" error that has become a hard error. The duplicates occurred when library directories were being added to rpath_list twice: - from lib_directories - from native system paths detection which includes the same dirs

1 files changed, 8 insertions(+), 0 deletions(-)

src/main.zig+8
...@@ -3389,6 +3389,14 @@ fn buildOutputType(...@@ -3389,6 +3389,14 @@ fn buildOutputType(
3389 var file_system_inputs: std.ArrayListUnmanaged(u8) = .empty;3389 var file_system_inputs: std.ArrayListUnmanaged(u8) = .empty;
3390 defer file_system_inputs.deinit(gpa);3390 defer file_system_inputs.deinit(gpa);
33913391
3392 // Deduplicate rpath entries
3393 var rpath_dedup = std.StringArrayHashMapUnmanaged(void){};
3394 for (create_module.rpath_list.items) |rpath| {
3395 try rpath_dedup.put(arena, rpath, {});
3396 }
3397 create_module.rpath_list.clearRetainingCapacity();
3398 try create_module.rpath_list.appendSlice(arena, rpath_dedup.keys());
3399
3392 var create_diag: Compilation.CreateDiagnostic = undefined;3400 var create_diag: Compilation.CreateDiagnostic = undefined;
3393 const comp = Compilation.create(gpa, arena, &create_diag, .{3401 const comp = Compilation.create(gpa, arena, &create_diag, .{
3394 .dirs = dirs,3402 .dirs = dirs,