aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorxackus <14938807+xackus@users.noreply.github.com>2020-12-15 19:30:00 +0100
committerAndrew Kelley <andrew@ziglang.org>2021-01-08 20:07:59 -0700
commite4b8148e9c0dc8e1e523965456a59d469e93a26c (patch)
tree07f4da41e0fd295a45cee5530ba24edc63161c06 /lib/std
parenteb696e453ff770e54188e14acb65e01e87a4eebd (diff)
downloadzig-e4b8148e9c0dc8e1e523965456a59d469e93a26c.tar.gz
zig-e4b8148e9c0dc8e1e523965456a59d469e93a26c.zip
Fix system library path detection on linux
Uses the NativeTargetInfo results instead of std.Target.current.
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/zig/system.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig
index a052c81a7d..ea1e3c87a2 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?