From c685b675e547f61c81c5fb63159bc12b26405100 Mon Sep 17 00:00:00 2001 From: Michael Dusan Date: Tue, 15 Aug 2023 17:20:05 -0400 Subject: std.debug: avoid os.getFdPath Commit ea9917d9bd921f9fc14028a8dbf9e3f0f2579120 introduced usage of fs.Dir.realpath which eventually calls os.getFdpath which is forbidden to be used by the compiler. It causes building zig to fail on OpenBsd, NetBSD and older versions of FreeBSD and DragonFly. This patch substitutes with os.realpath on libc targets and eventually calls c.realpath and allows zig to build. Any use of realpath is not desired but this is the lesser evil. --- lib/std/debug.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/std/debug.zig') diff --git a/lib/std/debug.zig b/lib/std/debug.zig index db9b93dff6..0657d667c2 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -1228,7 +1228,7 @@ pub fn readElfDebugInfo( } var cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined; - const cwd_path = fs.cwd().realpath("", &cwd_buf) catch break :blk; + const cwd_path = os.realpath(".", &cwd_buf) catch break :blk; // // for (global_debug_directories) |global_directory| { -- cgit v1.2.3 From e288c546996d202e87168f25d689a2f21fe03b60 Mon Sep 17 00:00:00 2001 From: Michael Dusan Date: Thu, 17 Aug 2023 10:50:52 -0400 Subject: std.debug: openbsd does not have getcontext --- lib/std/debug.zig | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/std/debug.zig') diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 0657d667c2..7a32271953 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -168,6 +168,7 @@ pub fn relocateContext(context: *ThreadContext) void { } pub const have_getcontext = @hasDecl(os.system, "getcontext") and + builtin.os.tag != .openbsd and (builtin.os.tag != .linux or switch (builtin.cpu.arch) { .x86, .x86_64, -- cgit v1.2.3