From 2148336a8145c5db66bb0ea11ad02dd0813942f0 Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Mon, 31 Aug 2020 18:10:44 +0200 Subject: [PATCH] follow filesystem hierarchy standard when adding lib directories --- lib/std/zig/system.zig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig index d24e8a57e9..37eea36d47 100644 --- 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)