Skip to content

Commit e8b6dd0

Browse files
martinjlowmjustsmth
authored andcommitted
Fix Darwin builds for non-standard environments (e.g. Nix)
1 parent 3728f18 commit e8b6dd0

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
@@ -391,6 +391,8 @@ impl CcBuilder {
391391
let mut new_cflags = original_cflags.clone();
392392
// The `_FORTIFY_SOURCE` macro often requires optimizations to also be enabled, so unset it.
393393
new_cflags.push_str(" -O0 -Wp,-U_FORTIFY_SOURCE");
394+
// Certain MacOS system headers are guarded by _POSIX_C_SOURCE and _DARWIN_C_SOURCE
395+
new_cflags.push_str(" -D_DARWIN_C_SOURCE");
394396
set_env_for_target("CFLAGS", &new_cflags);
395397
// cc-rs currently prioritizes flags provided by CFLAGS over the flags provided by the build script.
396398
// The environment variables used by the compiler are set when `get_compiler` is called.

0 commit comments

Comments
 (0)