zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit bc921fec122f4fa9e9a3957657c6ee74d6870f5b (tree)
parent 97df4ae3ce34ae2f1ac8298a99faaf990e22ca75
Author: Frank Denis <github@pureftpd.org>
Date:   Thu,  4 Sep 2025 23:09:09 +0200

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

Diffstat:
Msrc/main.zig | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/main.zig b/src/main.zig @@ -3389,6 +3389,14 @@ fn buildOutputType( var file_system_inputs: std.ArrayListUnmanaged(u8) = .empty; defer file_system_inputs.deinit(gpa); + // Deduplicate rpath entries + var rpath_dedup = std.StringArrayHashMapUnmanaged(void){}; + for (create_module.rpath_list.items) |rpath| { + try rpath_dedup.put(arena, rpath, {}); + } + create_module.rpath_list.clearRetainingCapacity(); + try create_module.rpath_list.appendSlice(arena, rpath_dedup.keys()); + var create_diag: Compilation.CreateDiagnostic = undefined; const comp = Compilation.create(gpa, arena, &create_diag, .{ .dirs = dirs,