Skip to content
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

Fix LLVM ERROR: cannot get default cache directory #17

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

banjun
Copy link
Owner

@banjun banjun commented Feb 5, 2024

With Xcode 15.3 (and/or some conditions), swiftc may cause error. we've observed it during a build using NSTaskCommand.

🍓 build stderr:
LLVM ERROR: cannot get default cache directory

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

@banjun banjun marked this pull request as ready for review February 5, 2024 09:11
@banjun banjun merged commit f56cc5b into main Feb 5, 2024
6 checks passed
@banjun banjun deleted the fix-llvm-cache-dir-error branch February 5, 2024 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant