Skip to content

Commit

Permalink
fix(zld): fix linker issue on windows
Browse files Browse the repository at this point in the history
And don't use lld on macos
  • Loading branch information
Ultra-Code committed Sep 30, 2024
1 parent d05a03f commit af8242b
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ pub fn build(b: *std.Build) void {
const strip = b.option(bool, "strip", "Strip debug information") orelse false;
const lto = b.option(bool, "lto", "Enable link time optimization") orelse false;

// writing WritingLibFiles isn't implemented on windows
// and zld the only linker suppored on macos
const use_lld = if (builtin.os.tag == .macos or
builtin.os.tag == .windows or optimize == .Debug) false else true;

const liblmdb = b.addStaticLibrary(.{
.name = "lmdb",
.target = target,
Expand All @@ -25,10 +30,7 @@ pub fn build(b: *std.Build) void {
.Debug => false,
else => true,
},
.use_lld = switch (optimize) {
.Debug => false,
else => true,
},
.use_lld = use_lld,
});
liblmdb.want_lto = lto;
liblmdb.root_module.sanitize_c = false;
Expand Down Expand Up @@ -85,10 +87,7 @@ pub fn build(b: *std.Build) void {
.Debug => false,
else => true,
},
.use_lld = switch (optimize) {
.Debug => false,
else => true,
},
.use_lld = use_lld,
});
tool.root_module.sanitize_c = false;

Expand Down

0 comments on commit af8242b

Please sign in to comment.