From dcceb318e0c39d8b463f5fd53eb0d6085c011b79 Mon Sep 17 00:00:00 2001 From: K4 Date: Thu, 20 Aug 2026 15:26:03 +0300 Subject: [PATCH] std.DynLib: find libraries located in `/lib64` and `/usr/lib64` Resolves https://github.com/ziglang/zig/issues/25906 --- lib/std/dynamic_library.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/std/dynamic_library.zig b/lib/std/dynamic_library.zig index 98bcafb88b16504cfab619d8407675b5014fd6e9..37001e165729cd87af1fcdf9a93ae6d5d5ae0819 100644 --- a/lib/std/dynamic_library.zig +++ b/lib/std/dynamic_library.zig @@ -198,7 +198,6 @@ pub const ElfDynLib = struct { // - DT_RUNPATH of the calling binary is not used as a search path // - /etc/ld.so.cache is not read fn resolveFromName(io: Io, path_or_name: []const u8, LD_LIBRARY_PATH: ?[]const u8) !Io.File { - // If filename contains a slash ("/"), then it is interpreted as a (relative or absolute) pathname if (std.mem.findScalarPos(u8, path_or_name, 0, '/')) |_| { return Io.Dir.cwd().openFile(io, path_or_name, .{}); } @@ -214,9 +213,10 @@ pub const ElfDynLib = struct { } } - // Lastly the directories /lib and /usr/lib are searched (in this exact order) if (resolveFromParent(io, "/lib", path_or_name)) |file| return file; + if (resolveFromParent(io, "/lib64", path_or_name)) |file| return file; if (resolveFromParent(io, "/usr/lib", path_or_name)) |file| return file; + if (resolveFromParent(io, "/usr/lib64", path_or_name)) |file| return file; return error.FileNotFound; } -- 2.54.0