compilers are not detected and found
Hello,
I have working clang and clang++ compilers both at usr/bin/clang(++) and at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man/man1/clang(++).1
but they are not detected. Can someone tell me what to do? This is not covered in any SO post or youtube video that I saw. Thanks!
请先登录再写评论。
Hello!
Do you have Xcode command line developer tools installed (https://www.jetbrains.com/help/clion/quick-tutorial-on-configuring-clion-on-macos.html#reqtools)? What output do you get if you execute
xcode-select --install
in Terminal?Thanks for your answer. I already installed xcode and running
xcode-select --install
givesxcode-select: note: Command line tools are already installed….
What does your toolchain in CLion look like? Please provide a screenshot of it from
Preferences | Build, Execution, Deployment | Toolchains
.Please empty the “C Compiler” and “C++ Compiler” fields. Do you still see the “Test CMake run finished with errors” message after that?
No I don't.
Is it suitable for you? In this case, CLion will use compilers which it auto-detected. Most probably those are from Xcode command line developer tools. You can check that by hovering over the “C Compiler” and “C++ Compiler” fields.
I appended a screenshot but for some reason it is not shown. Thanks for your answer.
I get this error now
CMake Error at /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man/man1/clang.1"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: '/Users/david/Programming/Cpp/cmake-build-debug/CMakeFiles/CMakeScratch/TryCompile-0hM4EL'
Run Build Command(s): /Applications/CLion.app/Contents/bin/ninja/mac/aarch64/ninja -v cmTC_e5f3e
[1/2] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man/man1/clang.1 -arch arm64 -o CMakeFiles/cmTC_e5f3e.dir/testCCompiler.c.o -c /Users/david/Programming/Cpp/cmake-build-debug/CMakeFiles/CMakeScratch/TryCompile-0hM4EL/testCCompiler.c
FAILED: CMakeFiles/cmTC_e5f3e.dir/testCCompiler.c.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man/man1/clang.1 -arch arm64 -o CMakeFiles/cmTC_e5f3e.dir/testCCompiler.c.o -c /Users/david/Programming/Cpp/cmake-build-debug/CMakeFiles/CMakeScratch/TryCompile-0hM4EL/testCCompiler.c
/bin/sh: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man/man1/clang.1: Permission denied
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Ensure the paths to
clang
andclang++
are in yourPATH
variable. Set Xcode command line tools withxcode-select --install
. Verify by runningclang --version
.David Schuldes, do you still face the issue, or was it resolved?