Fix LLVM ERROR: cannot get default cache directory #17
+8
−2
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.
With Xcode 15.3 (and/or some conditions), swiftc may cause error. we've observed it during a build using NSTaskCommand.
The PR is a quick workaround for that, assuming LLVM requires env HOME for that case.
References:
LLVM in Xcode may be differ than OSS apple/llvm-project...
https://forums.swift.org/t/xcode-ships-llvm-15-but-swift-builds-llvm-16/67377
report_fatal_error("cannot get default cache directory");
<-cache_directory
https://github.com/apple/llvm-project/blob/swift/release/5.10/llvm/lib/CAS/ActionCaches.cpp#L140
<-
home_directory
https://github.com/apple/llvm-project/blob/swift/release/5.10/llvm/lib/Support/Unix/Path.inc#L1452
<-
getenv("HOME")
https://github.com/apple/llvm-project/blob/swift/release/5.10/llvm/lib/Support/Unix/Path.inc#L1375