I was trying to build the swift compiler, by following the step by step procedure from the this documentation. Then, when I reached the 3rd step of The actual build, then I got this error:
CMake Error at /opt/homebrew/Cellar/cmake/3.24.2/share/cmake/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
Hey @Shreyansh,
Couple of questions, what does xcode-select -p returns?
Also, which version of Xcode is Xcode 2? Are your command line tools correctly installed(did you try running xcode-select --install after selecting Xcode 2)?
We have seen something similar in Build failure locally, you can take a look there see if there is any useful info, this could be likely a mismatch of tools since you probably have more than one Xcode in your machine. So my guess would be try to make sure that everything is pointing to the correct one.
Is hard to say... is definitely something with tooling cmake is using to build things or something in your system. Which macOS version is it?
When you run the command you should see something like
-- CMake (/opt/homebrew/Cellar/cmake/3.22.2/bin/cmake) Version: 3.22.2
-- CMake Make Program (/opt/homebrew/bin/ninja) Version: 1.10.2
-- C Compiler (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang) Version: 13.0.0.13000029
-- C++ Compiler (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++) Version: 13.0.0.13000029
Could you send what appears in your output? (Just search on terminal for -- CMake)
Also given you have an Xcode 2, you probably have another version of Xcode right? Could you try select that one xcode-select -s ${PATH}, run command line install and try a new build-script invocation adding --clean?
@LucianoPAlmeida,
Thank You very much for still holding up with the problem!
As you've asked:
The mac OS version I'm using is Ventura 13.0, the other version of xcode (Xcode 14.0.1 (Build version 14A400)) you are talking about is not able to run the build script, that is why I installed an older version(Xcode 14.0.0 (14A309)) of it in the first place.
This was what showed up in the terminal when I ran the command:
-- The C compiler identification is AppleClang 14.0.0.14000029
-- The Swift compiler identification is Apple 5.7
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /Applications/Xcode 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Check for working C compiler: /Applications/Xcode 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - broken
I would try to remove this Xcode 2 completely, xcode-select -s the original one, xcode-select --install to make sure tools are installed and then run the build-script command with --clean but more importantly SKIP_XCODE_VERSION_CHECK=1.
Example: SKIP_XCODE_VERSION_CHECK=1 ./swift/utils/build-script --skip-build-benchmarks \ --skip-ios --skip-watchos --skip-tvos --swift-darwin-supported-archs "$(uname -m)" \ --sccache --release-debuginfo --swift-disable-dead-stripping