Recently running utils/build-script --swift-darwin-supported-archs "$(uname -m)" --xcode
is failing for me with the following error:
CMake Error at cmake/modules/SwiftSharedCMakeConfig.cmake:16 (find_package):
Could not find a package configuration file provided by "LLVM" with any of
the following names:
LLVMConfig.cmake
llvm-config.cmake
Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set
"LLVM_DIR" to a directory containing one of the above files. If "LLVM"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
cmake/modules/SwiftSharedCMakeConfig.cmake:253 (swift_common_standalone_build_config_llvm)
CMakeLists.txt:746 (swift_common_standalone_build_config)
I believe this is after the rebranch of llvm to stable/20221013
and comparing it with stable/20220421
I found this commit [CMake] Avoid `LLVM_BINARY_DIR` when other more specific variable are… · apple/llvm-project@3a1c81e · GitHub which seems to modify the expected output paths for llvm artifacts, which could be the reason of the cannot find the llvm config files error
.
Was able to make the command by locally reverting few bits of this commit to the old paths. Mainly this one https://github.com/apple/llvm-project/blob/cfef3b68f103f6d9e1f0908536df1bfae2dc1730/llvm/cmake/modules/CMakeLists.txt#L6
since was the library failing. And apparently the command now runs successfully with this workaround ... but I don't know what would be the actual fix(still trying to better understand the problem) for this issue so opening this thread here. Could be along the lines of changing the path that swift looks for then?
Also can follow up with an issue on swift repo as well.
cc @contributor-experience-workgroup should we introduce some kind of check in CI to ensure utils/build-script --swift-darwin-supported-archs "$(uname -m)" --xcode
runs successfully? Seems like cmake changes either on llvm or swift side could aftect it and contributors in general could run into issues when following GettingStarted
for setup.