Fix Darwin builds for non-standard environments (e.g. Nix) #941
+9
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.