Compile Xcode toolchain from source (original) (raw)
I used to compile all the time from scratch, but it no longer works anymore. Here’s the command I run from the build file:
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DLLVM_CREATE_XCODE_TOOLCHAIN=ON -G “Unix Makefiles” /Volumes/Developer\ SSD/llvm-project/llvm
Then I get this error. If I compile without the toolchain flag, everything works fine. I Rolled back to llvm19 and get the same error. Something has changed and I haven’t compiled from source for a while.
Does anyone know what’s going on?
Thanks.
– Targeting WebAssembly
– Targeting X86
– Targeting XCore
CMake Error at tools/xcode-toolchain/CMakeLists.txt:52 (string):
string sub-command REGEX, mode MATCH needs at least 5 arguments total to
command.
CMake Warning at tools/xcode-toolchain/CMakeLists.txt:60 (message):
Failed to detect the version of an installed copy of Xcode, falling back to
highest supported version. Set XCODE_VERSION to override.
CMake Error at tools/xcode-toolchain/CMakeLists.txt:80 (message):
Could not identify toolchain dir
– Configuring incomplete, errors occurred!
From the errors, it looks like the build is trying to run xcodebuild -version
and xcrun -find otool
, but they both failed. Do you have XCode installed?
Yes. I just installed the latest Xcode 16.4 with the latest Sequoia. Strangely enough, when I run xcodebuild --version, I get this:
xcode-select: error: tool ‘xcodebuild’ requires Xcode, but active developer directory ‘/Library/Developer/CommandLineTools’ is a command line tools instance
For some reason xcode-select -p returned this:
/Library/Developer/CommandLineTools
I ran xcode-select -r to reset the path to the command line tools and the path was reset to Xcode.app. It is working now.
Thanks for your help.