diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig index a052c81a7daab71e112f5d8dffc34bbb2140f9b2..ea1e3c87a22623ea588a7f14b98a9da12b2f51d2 100644 --- a/lib/std/zig/system.zig +++ b/lib/std/zig/system.zig @@ -15,8 +15,6 @@ const Target = std.Target; const CrossTarget = std.zig.CrossTarget; const macos = @import("system/macos.zig"); -const is_windows = Target.current.os.tag == .windows; - pub const getSDKPath = macos.getSDKPath; pub const NativePaths = struct { @@ -26,7 +24,9 @@ pub const NativePaths = struct { rpaths: ArrayList([:0]u8), warnings: ArrayList([:0]u8), - pub fn detect(allocator: *Allocator) !NativePaths { + pub fn detect(allocator: *Allocator, native_info: NativeTargetInfo) !NativePaths { + const native_target = native_info.target; + var self: NativePaths = .{ .include_dirs = ArrayList([:0]u8).init(allocator), .lib_dirs = ArrayList([:0]u8).init(allocator), @@ -103,9 +103,9 @@ pub const NativePaths = struct { return self; } - if (!is_windows) { - const triple = try Target.current.linuxTriple(allocator); - const qual = Target.current.cpu.arch.ptrBitWidth(); + if (native_target.os.tag != .windows) { + const triple = try native_target.linuxTriple(allocator); + const qual = native_target.cpu.arch.ptrBitWidth(); // TODO: $ ld --verbose | grep SEARCH_DIR // the output contains some paths that end with lib64, maybe include them too? diff --git a/src/main.zig b/src/main.zig index 668e601475e39a6afa65f6c084b556c1a11c851f..992581fe525a48ba28224804ec4c19cd1d4f0a57 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1448,7 +1448,7 @@ fn buildOutputType( } if (cross_target.isNativeOs() and (system_libs.items.len != 0 or want_native_include_dirs)) { - const paths = std.zig.system.NativePaths.detect(arena) catch |err| { + const paths = std.zig.system.NativePaths.detect(arena, target_info) catch |err| { fatal("unable to detect native system paths: {s}", .{@errorName(err)}); }; for (paths.warnings.items) |warning| {