authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-10-18 23:37:47-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-10-18 23:37:47-07:00
logae2cd5fe263e9d8ddd5719b4795f9cd39b5c0324
tree49058ce872193ded1dc4a3a37fe4c5295f1f18f9
parent470d887d801a982e4cd7ecfc5b0e736d92e8b414

Revert "Never implicitly add rpaths for each lib dir, add NixOS libdir to rpath"

This reverts commit d7b73af8f65bb891c8700ed47777144bb6f35fe1. I did not look at this closely enough. This is incorrect; it should not implicitly add rpaths for every library, and it should not disable the nice default of each_lib_path when compiling for the native OS. See #16062 where we are working on a follow-up improvement to this.

2 files changed, 1 insertions(+), 2 deletions(-)

lib/std/zig/system/NativePaths.zig-1
...@@ -61,7 +61,6 @@ pub fn detect(arena: Allocator, native_info: NativeTargetInfo) !NativePaths {...@@ -61,7 +61,6 @@ pub fn detect(arena: Allocator, native_info: NativeTargetInfo) !NativePaths {
61 } else if (word.len > 2 and word[0] == '-' and word[1] == 'L') {61 } else if (word.len > 2 and word[0] == '-' and word[1] == 'L') {
62 const lib_path = word[2..];62 const lib_path = word[2..];
63 try self.addLibDir(lib_path);63 try self.addLibDir(lib_path);
64 try self.addRPath(lib_path);
65 } else {64 } else {
66 try self.addWarningFmt("Unrecognized C flag from NIX_LDFLAGS: {s}", .{word});65 try self.addWarningFmt("Unrecognized C flag from NIX_LDFLAGS: {s}", .{word});
67 break;66 break;
src/Compilation.zig+1-1
...@@ -1662,7 +1662,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {...@@ -1662,7 +1662,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
1662 .llvm_cpu_features = llvm_cpu_features,1662 .llvm_cpu_features = llvm_cpu_features,
1663 .skip_linker_dependencies = options.skip_linker_dependencies,1663 .skip_linker_dependencies = options.skip_linker_dependencies,
1664 .parent_compilation_link_libc = options.parent_compilation_link_libc,1664 .parent_compilation_link_libc = options.parent_compilation_link_libc,
1665 .each_lib_rpath = options.each_lib_rpath orelse false,1665 .each_lib_rpath = options.each_lib_rpath orelse options.is_native_os,
1666 .build_id = build_id,1666 .build_id = build_id,
1667 .cache_mode = cache_mode,1667 .cache_mode = cache_mode,
1668 .disable_lld_caching = options.disable_lld_caching or cache_mode == .whole,1668 .disable_lld_caching = options.disable_lld_caching or cache_mode == .whole,