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
[SR-11504] for some reason, /usr/local/include takes priority over the SDK #4662
Comments
@swift-ci create |
CC @belkadan/@ddunbar/@aciidb0mb3r |
Xcode has no trouble building swift-nio even in the presence of the bogus |
I think we looked into this before and it turns out to come from how the command-line tools work on macOS without being invoked through xcrun, or maybe without an explicit SDK (either from xcrun or from |
(As in, this is expected behavior on macOS and we aren't going to change it.) |
@belkadan wait, |
This is xcrun's behavior when an explicit SDK is not passed and `swift build` goes through xcrun on macOS. From xcrun's man page: CPATH
This environment variable is modified by xcrun to include /usr/local/include when an explicit SDK is not requested via environment vari-
able nor command line argument and neither -nostdinc nor -nostdsysteminc are present. @weissi It'll work if you run `xcrun -sdk macosx swift build` This has known to cause one other similar issue so far. I don't know if it's a good idea for SwiftPM to try to detect and unset this env variable. |
@aciidb0mb3r oh nice, thank you! Hmm, I think SwiftPM and Xcode should behave the same by default? |
I agree that they should but this is an unfortunate bug because of the implementation details of the underlying tools. There's no way to properly detect if CPATH was set by xcrun or not. |
yup... |
Additional Detail from JIRA
md5: b40fb2b5182a5282640ecfe2f7c53671
Issue Description:
Even if not asked to add any directories to the include path, when invoking (the) clang (importer),
/usr/local/include
seems to take priority over the SDK.Repro:
Note, to unbrick your computer, run
sudo rm -f /usr/local/include/string.h
.Result:
The text was updated successfully, but these errors were encountered: