Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions aws-lc-sys/builder/cc_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ impl CcBuilder {
let mut new_cflags = original_cflags.clone();
// The `_FORTIFY_SOURCE` macro often requires optimizations to also be enabled, so unset it.
new_cflags.push_str(" -O0 -Wp,-U_FORTIFY_SOURCE");
// Certain MacOS system headers are guarded by _POSIX_C_SOURCE and _DARWIN_C_SOURCE
new_cflags.push_str(" -D_DARWIN_C_SOURCE");
Comment on lines +386 to +387
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is likely not the best place to add this flag. I'll update this PR and try to add a CI job for nix.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Justin - I have a small reproducible example I can share for our crate2nix fork. You should be able to incorporate this into a CI job

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that would be appreciated. My understanding of Nix is currently limited. 😀

Copy link
Contributor

@justsmth justsmth Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the output you shared, I'm thinking that the best place for this change might be upstream in AWS-LC -- specifically above this line in cpu_aarch64_apple.c. But I would need to test it.

I think we ahould also be able to reproduce this issue upstream in AWS-LC. We do test w/ Nix, but perhaps not for this target.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/martinjlowm/crate2nix-aws-lc-mr here goes - the step to run is documented in the README. I assume you have Nix installed already.

set_env_for_target("CFLAGS", &new_cflags);
// cc-rs currently prioritizes flags provided by CFLAGS over the flags provided by the build script.
// The environment variables used by the compiler are set when `get_compiler` is called.
Expand Down
Loading