简体   繁体   中英

cmake .. -G Xcode suddenly fails with the project it used to work with

I have a project, where I used to do cmake .. -G Xcode to build for Xcode and it used to work fine. I haven't touched the project for a month or so and when I ran the same command today I got an error below.

The only thing I changed since the last time I built the project was doing some Rust tutorial, so I installed some things for Rust, but I don't remember what exactly.

What could have happened?

-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- broken
CMake Error at /usr/local/Cellar/cmake/3.16.4/share/cmake/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/path-to-project/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/xcodebuild -project CMAKE_TRY_COMPILE.xcodeproj build -target cmTC_a8107 -configuration Debug -hideShellScriptEnvironment && Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project CMAKE_TRY_COMPILE.xcodeproj build -target cmTC_a8107 -configuration Debug -hideShellScriptEnvironment
User defaults from command line:
HideShellScriptEnvironment = YES
Prepare build
note: The Legacy Build System will be removed in a future release. You can configure the selected build system and this deprecation message in File > Project Settings.
=== BUILD TARGET cmTC_a8107 OF PROJECT CMAKE_TRY_COMPILE WITH CONFIGURATION Debug ===
Check dependencies
No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=arm64, VALID_ARCHS=arm64 arm64e i386 x86_64, EXCLUDED_ARCHS=(
arm64,
arm64e
)).
** BUILD FAILED **
The following build commands failed:
 Check dependencies
(1 failure)
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
-- Configuring incomplete, errors occurred!
See also "/Users/path-to-project/build/CMakeFiles/CMakeOutput.log".
See also "/Users/path-to-project/build/CMakeFiles/CMakeError.log".

将 cmake 更新到最新版本(3.18.4)为我解决了这个问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM