Skip to content

Commit 2ba570e

Browse files
committed
fix(build): fix unknown type u_char|int|long on macos builds
pass -D_DARWIN_C_SOURCE to macos builds, from my reading online this macro defines some legacy typedefs from BSD that are still lingering in macos headers
1 parent fcbe308 commit 2ba570e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

build.zig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ pub fn build(b: *std.Build) void {
5858
});
5959
liblmdb.addIncludePath(lmdb_upstream.path(lmdb_root));
6060
liblmdb.root_module.addCMacro("_XOPEN_SOURCE", "600");
61+
if (is_macos) {
62+
liblmdb.root_module.addCMacro("_DARWIN_C_SOURCE", "");
63+
}
6164

6265
liblmdb.installHeadersDirectory(
6366
lmdb_upstream.path(lmdb_root),
@@ -101,6 +104,9 @@ pub fn build(b: *std.Build) void {
101104
});
102105
tool.addIncludePath(lmdb_upstream.path(lmdb_root));
103106
tool.root_module.addCMacro("_XOPEN_SOURCE", "600");
107+
if (is_macos) {
108+
tool.root_module.addCMacro("_DARWIN_C_SOURCE", "");
109+
}
104110
tool.linkLibrary(liblmdb);
105111

106112
const install_tool = b.addInstallArtifact(tool, .{});

0 commit comments

Comments
 (0)