authorgravatar for k4@noreply.codeberg.orgK4 <k4@noreply.codeberg.org> 2026-08-20 15:26:03+03:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-08-23 14:16:37+02:00
logdcceb318e0c39d8b463f5fd53eb0d6085c011b79
tree6eaa3f1339210c012766acaf9b1e6b6abb9ecdc0
parent2eadc2177a673c5ca5130d677c0eebca8a8eb981

std.DynLib: find libraries located in `/lib64` and `/usr/lib64`

Resolves https://github.com/ziglang/zig/issues/25906

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

lib/std/dynamic_library.zig+2-2
...@@ -198,7 +198,6 @@ pub const ElfDynLib = struct {...@@ -198,7 +198,6 @@ pub const ElfDynLib = struct {
198 // - DT_RUNPATH of the calling binary is not used as a search path198 // - DT_RUNPATH of the calling binary is not used as a search path
199 // - /etc/ld.so.cache is not read199 // - /etc/ld.so.cache is not read
200 fn resolveFromName(io: Io, path_or_name: []const u8, LD_LIBRARY_PATH: ?[]const u8) !Io.File {200 fn resolveFromName(io: Io, path_or_name: []const u8, LD_LIBRARY_PATH: ?[]const u8) !Io.File {
201 // If filename contains a slash ("/"), then it is interpreted as a (relative or absolute) pathname
202 if (std.mem.findScalarPos(u8, path_or_name, 0, '/')) |_| {201 if (std.mem.findScalarPos(u8, path_or_name, 0, '/')) |_| {
203 return Io.Dir.cwd().openFile(io, path_or_name, .{});202 return Io.Dir.cwd().openFile(io, path_or_name, .{});
204 }203 }
...@@ -214,9 +213,10 @@ pub const ElfDynLib = struct {...@@ -214,9 +213,10 @@ pub const ElfDynLib = struct {
214 }213 }
215 }214 }
216215
217 // Lastly the directories /lib and /usr/lib are searched (in this exact order)
218 if (resolveFromParent(io, "/lib", path_or_name)) |file| return file;216 if (resolveFromParent(io, "/lib", path_or_name)) |file| return file;
217 if (resolveFromParent(io, "/lib64", path_or_name)) |file| return file;
219 if (resolveFromParent(io, "/usr/lib", path_or_name)) |file| return file;218 if (resolveFromParent(io, "/usr/lib", path_or_name)) |file| return file;
219 if (resolveFromParent(io, "/usr/lib64", path_or_name)) |file| return file;
220 return error.FileNotFound;220 return error.FileNotFound;
221 }221 }
222222