Chars Davy
Chars Davy

Reputation: 1733

CMake compiler identification is unknown for MacOS 10.13.3

I want to build llvm via cmake,

and I use cmake -G Xcode ../llvm -DCMAKE_BUILD_TYPE:STRING=MinSizeRel.

But I'm in trouble.

The error log is:

CMake Deprecation Warning at CMakeLists.txt:14 (cmake_policy):
  The OLD behavior for policy CMP0051 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- The ASM compiler identification is unknown
-- Found assembler: /Library/Developer/CommandLineTools/usr/bin/cc
CMake Error at CMakeLists.txt:45 (project):
  No CMAKE_C_COMPILER could be found.

CMake Error at CMakeLists.txt:45 (project):
  No CMAKE_CXX_COMPILER could be found.

-- Warning: Did not find file Compiler/-ASM
-- Configuring incomplete, errors occurred!

Moreover, I also use xcrun -find cc, result is /Library/Developer/CommandLineTools/usr/bin/cc

What can I do? Please help

Upvotes: 5

Views: 4650

Answers (3)

John Zhang
John Zhang

Reputation: 621

try this

sudo xcodebuild -license

Upvotes: 0

Ľubomír Carik
Ľubomír Carik

Reputation: 407

Please, let try this:

  • what version of CMake/Xcode is used? the most recent?
  • pls. check if you don't have old/previous cmake build folder in source code
  • if you upgrade Xcode, don't forget install command line tools again via

    sudo xcode-select --install

  • a side-note: the CMake option 'CMAKE_BUILD_TYPE' is useless for Xcode generator; this variable work only for Makefiles builds - remove it from command line and when the configuration will work, trigger the build via:

    cmake --build . --config MinSizeRel

Upvotes: 0

Chars Davy
Chars Davy

Reputation: 1733

If you have installed Xcode, try this:

sudo xcode-select --reset

Upvotes: 10

Related Questions