commit 2148336a8145c5db66bb0ea11ad02dd0813942f0 (tree)
parent 8dc58a4e944e5d319079a56802ce0824096bd7b5
Author: Jan200101 <sentrycraft123@gmail.com>
Date: Mon, 31 Aug 2020 18:10:44 +0200
follow filesystem hierarchy standard when adding lib directories
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig
@@ -88,6 +88,7 @@ pub const NativePaths = struct {
if (!is_windows) {
const triple = try Target.current.linuxTriple(allocator);
+ const qual = Target.current.cpu.arch.ptrBitWidth();
// TODO: $ ld --verbose | grep SEARCH_DIR
// the output contains some paths that end with lib64, maybe include them too?
@@ -95,17 +96,17 @@ pub const NativePaths = struct {
// TODO: some of these are suspect and should only be added on some systems. audit needed.
try self.addIncludeDir("/usr/local/include");
+ try self.addLibDirFmt("/usr/local/lib{}", .{qual});
try self.addLibDir("/usr/local/lib");
- try self.addLibDir("/usr/local/lib64");
try self.addIncludeDirFmt("/usr/include/{}", .{triple});
try self.addLibDirFmt("/usr/lib/{}", .{triple});
try self.addIncludeDir("/usr/include");
+ try self.addLibDirFmt("/lib{}", .{qual});
try self.addLibDir("/lib");
- try self.addLibDir("/lib64");
+ try self.addLibDirFmt("/usr/lib{}", .{qual});
try self.addLibDir("/usr/lib");
- try self.addLibDir("/usr/lib64");
// example: on a 64-bit debian-based linux distro, with zlib installed from apt:
// zlib.h is in /usr/include (added above)