clion mac版升级后不能编译,显示missing xcrun等问题解决

该问题可能会在升级mac系统或者clion客户端后发生,发生error日志一般如下,大多显示missing xcrun

问题描述:

Error:The C compiler "/usr/bin/cc" is not able to compile a simple test program.
It fails with the following output:
 Change Dir: /Users/juniorlima/Library/Caches/CLion2016.2/cmake/generated/lesk-e04046c3/e04046c3/__default__/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_ab383/fast"
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
CMake will not be able to correctly generate this project.
Error:Configuration Debug
The C compiler "/usr/bin/cc" is not able to compile a simple test program.
It fails with the following output:
 Change Dir: /Users/juniorlima/Library/Caches/CLion2016.2/cmake/generated/lesk-e04046c3/e04046c3/Debug/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_4c8ea/fast"
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
CMake will not be able to correctly generate this project.
Error:Configuration Release
The C compiler "/usr/bin/cc" is not able to compile a simple test program.
It fails with the following output:
 Change Dir: /Users/juniorlima/Library/Caches/CLion2016.2/cmake/generated/lesk-e04046c3/e04046c3/Release/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_d38b8/fast"
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
CMake will not be able to correctly generate this project.
Error:Configuration RelWithDebInfo
The C compiler "/usr/bin/cc" is not able to compile a simple test program.
It fails with the following output:
 Change Dir: /Users/juniorlima/Library/Caches/CLion2016.2/cmake/generated/lesk-e04046c3/e04046c3/RelWithDebInfo/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_67d49/fast"
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
CMake will not be able to correctly generate this project.
Error:Configuration MinSizeRel
The C compiler "/usr/bin/cc" is not able to compile a simple test program.

解决方法:

在命令行中输入xcode-select  --install

通过重装xcode developer tools的方式解决,不需要安装完整的xcode

猜你喜欢

转载自blog.csdn.net/pro_misefetion/article/details/84485296