Skip to content

Commit

Permalink
fix(build): fix unknown type u_char|int|long on macos builds
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Ultra-Code committed Sep 30, 2024
1 parent fcbe308 commit 2ba570e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ pub fn build(b: *std.Build) void {
});
liblmdb.addIncludePath(lmdb_upstream.path(lmdb_root));
liblmdb.root_module.addCMacro("_XOPEN_SOURCE", "600");
if (is_macos) {
liblmdb.root_module.addCMacro("_DARWIN_C_SOURCE", "");
}

liblmdb.installHeadersDirectory(
lmdb_upstream.path(lmdb_root),
Expand Down Expand Up @@ -101,6 +104,9 @@ pub fn build(b: *std.Build) void {
});
tool.addIncludePath(lmdb_upstream.path(lmdb_root));
tool.root_module.addCMacro("_XOPEN_SOURCE", "600");
if (is_macos) {
tool.root_module.addCMacro("_DARWIN_C_SOURCE", "");
}
tool.linkLibrary(liblmdb);

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

0 comments on commit 2ba570e

Please sign in to comment.