Substitute ${SDKROOT}
and ${DEVELOPER_DIR}
by their environment variables on darwin.
#2619
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.
Substitute
${SDKROOT}
and${DEVELOPER_DIR}
by their environment variables on darwin.This PR attempts to fix an issue with bindgen when used on darwin with clang
compiled from source (i.e. from
@llvm-project
).When using clang compiled from source on darwin, libclang (used through
clang-sys
) failedto find system header files (such as
stdarg.h
orstdbool.h
) because thesefiles are actually living under the SDK path (under
<SDK_PATH>/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/
and<SDK_PATH>/usr/include
).Similar to what Bazel did in their
xcrunwrapper.sh
, we must have a way to tell bindgen's libclangwhere to find these system headers.
In this commit, I add the following two substitutes variables:
${SDKROOT}
: replaced bystd::env::var("SDKROOT")
if found.${DEVELOPER_DIR}
: replaced bystd::env::var("DEVELOPER")
if found.This is similar to what it is currently done for
${pwd}
.The following rule should now work on darwin:
It may also fix #1834.