Skip to content

Commit 8b5ae80

Browse files
committed
Fix Darwin builds for non-standard environments (e.g. Nix)
1 parent 1b9f98e commit 8b5ae80

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

aws-lc-sys/builder/cc_builder.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,8 @@ impl CcBuilder {
383383
let mut new_cflags = original_cflags.clone();
384384
// The `_FORTIFY_SOURCE` macro often requires optimizations to also be enabled, so unset it.
385385
new_cflags.push_str(" -O0 -Wp,-U_FORTIFY_SOURCE");
386+
// Certain MacOS system headers are guarded by _POSIX_C_SOURCE and _DARWIN_C_SOURCE
387+
new_cflags.push_str(" -D_DARWIN_C_SOURCE");
386388
set_env_for_target("CFLAGS", &new_cflags);
387389
// cc-rs currently prioritizes flags provided by CFLAGS over the flags provided by the build script.
388390
// The environment variables used by the compiler are set when `get_compiler` is called.

0 commit comments

Comments
 (0)