0

I am compiling a C++ application on CLion IDE using the Clang 12 from LLVM with CMake 3.20. MacOS version is 10.15.7.

The error I get is:

-- The C compiler identification is Clang 12.0.1
-- The CXX compiler identification is Clang 12.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /usr/local/Cellar/llvm/12.0.1/bin/clang-12
-- Check for working C compiler: /usr/local/Cellar/llvm/12.0.1/bin/clang-12 - broken
CMake Error at /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.20/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"/usr/local/Cellar/llvm/12.0.1/bin/clang-12"
is not able to compile a simple test program.

ld: unknown option: -platform_version
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [cmTC_ca485] Error 1
make: *** [cmTC_ca485/fast] Error 2

I was trying to solve the problem with the help of the following: Clang 10 fails to link C++ application with CMake on macOS 10.12 but to no avail. It seems CMake is using the linker from /usr/bin/. Forcing it to use the one from the same directory where Clang 12 resides (by using -DCMAKE_LINKER="/usr/local/Cellar/llvm/12.0.1/bin/lld) doesn't help. Not sure if it is relevant but when I try to get the linker version by running ld64.lld -v I get the error message:
ld64.lld: error: -arch not specified and could not be inferred

Any help will be highly appreciated.

seiji594
  • 13
  • 5

0 Answers0