错误描述:
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /Users/llwh/CLionProjects/suanfa6
CMake Warning at /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.21/Modules/Platform/Darwin-Initialize.cmake:303 (message):
Ignoring CMAKE_OSX_SYSROOT value:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
because the directory does not exist.
Call Stack (most recent call first):
/Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.21/Modules/CMakeSystemSpecificInitialize.cmake:21 (include)
CMakeLists.txt:2 (project)
-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - broken
CMake Error at /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"/Library/Developer/CommandLineTools/usr/bin/cc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/llww/CLionProjects/suanfa6/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make -f Makefile cmTC_35616/fast && /Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_35616.dir/build.make CMakeFiles/cmTC_35616.dir/build
Building C object CMakeFiles/cmTC_35616.dir/testCCompiler.c.o
/Library/Developer/CommandLineTools/usr/bin/cc -arch x86_64 -mmacosx-version-min=12.0 -MD -MT CMakeFiles/cmTC_35616.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_35616.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_35616.dir/testCCompiler.c.o -c /Users/llwh/CLionProjects/suanfa6/cmake-build-debug/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_35616
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -E cmake_link_script CMakeFiles/cmTC_35616.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/cc -arch x86_64 -mmacosx-version-min=12.0 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_35616.dir/testCCompiler.c.o -o cmTC_35616
ld: library not found for -lSystem
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [cmTC_35616] Error 1
make: *** [cmTC_35616/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "/Users/llwh/CLionProjects/suanfa6/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/Users/llwh/CLionProjects/suanfa6/cmake-build-debug/CMakeFiles/CMakeError.log".
[无法重新加载]
处理办法:
①安装了xcode:
xcode-select --install
②apple官网下了插件修复
③官网更新clion
④参考【软件安装】mac 更新系统后 clion 软件提示 cmake 不可用解决方案_Damu-CSDN博客_clion cmake不可用
clion操作:Tools->CMake->Reset Cache and Reload CMake 重置缓存并重新加载项目
可以正常运行了。
123每步都执行下④,可能就好了