-
Notifications
You must be signed in to change notification settings - Fork 89
Fix Darwin builds for non-standard environments (e.g. Nix) #941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| // Certain MacOS system headers are guarded by _POSIX_C_SOURCE and _DARWIN_C_SOURCE | ||
| new_cflags.push_str(" -D_DARWIN_C_SOURCE"); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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. 😀
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #941 +/- ##
==========================================
- Coverage 95.80% 92.36% -3.44%
==========================================
Files 61 73 +12
Lines 8143 9659 +1516
Branches 0 9659 +9659
==========================================
+ Hits 7801 8922 +1121
- Misses 342 450 +108
- Partials 0 287 +287 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
4311944 to
8b5ae80
Compare
Issues:
Not reported.
Description of changes:
aws-ls-sysfails to build via Nix (crate2nix) due to missing typedefs, presumably because the Clang used from the Nix sandbox doesn't set-D_DARWIN_C_SOURCE.The content of interest is https://github.com/alexey-lysiuk/macos-sdk/blob/main/MacOSX26.1.sdk/usr/include/sys/types.h#L83-L96 which doesn't evaluate unless
_DARWIN_C_SOURCEis set. The first POSIX branch is set because__STDC_ALLOC_LIB__isn't: https://github.com/aws/aws-lc/blob/main/crypto/err/err.c#L113C8-L117I suppose
_POSIX_C_SOURCEwas set for a reason and I can't figure out why a normal Cargo build would work - I cannot find any trace of__STDC_ALLOC_LIB__- apart from a comment in #610.The absence of
_DARWIN_C_SOURCEcauses the CC builder to throw:Call-outs:
This is unfamiliar territory for me. I don't know if configuring
_POSIX_C_SOURCEappropriately is the better option.Testing:
N/A
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.