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:56+02:00
logc15f8b9fc97e141bb59f7d11c3bf4ad76a5036ed
tree29340fa4af53dd5202dd35ac56b0755ec56f26d9
parent90c1123d1c9f02c0c2036053dcf9ad6b35e848da
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

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
...@@ -3395,6 +3395,14 @@ fn buildOutputType(...@@ -3395,6 +3395,14 @@ fn buildOutputType(
3395 var file_system_inputs: std.ArrayListUnmanaged(u8) = .empty;3395 var file_system_inputs: std.ArrayListUnmanaged(u8) = .empty;
3396 defer file_system_inputs.deinit(gpa);3396 defer file_system_inputs.deinit(gpa);
33973397
3398 // Deduplicate rpath entries
3399 var rpath_dedup = std.StringArrayHashMapUnmanaged(void){};
3400 for (create_module.rpath_list.items) |rpath| {
3401 try rpath_dedup.put(arena, rpath, {});
3402 }
3403 create_module.rpath_list.clearRetainingCapacity();
3404 try create_module.rpath_list.appendSlice(arena, rpath_dedup.keys());
3405
3398 var create_diag: Compilation.CreateDiagnostic = undefined;3406 var create_diag: Compilation.CreateDiagnostic = undefined;
3399 const comp = Compilation.create(gpa, arena, &create_diag, .{3407 const comp = Compilation.create(gpa, arena, &create_diag, .{
3400 .dirs = dirs,3408 .dirs = dirs,