Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 14 beta: CMake not able to resolve CMAKE_C_COMPILER and CMAKE_CXX_COMPILER

Trying to run cmake to create an Xcode project using:

cmake -G Xcode ..

This has been running perfectly under Xcode 13 and below. But under Xcode 14 beta, suddenly if fails, and I get the following output:

-- Found Git: /usr/bin/git (found version "2.32.1 (Apple Git-133)")
-- Found PythonInterp: /usr/local/bin/python3 (found suitable version "3.9", minimum required is "3")
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:17 (project):
  No CMAKE_C_COMPILER could be found.

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

More detail from CMakeFiles/CMakeError.log includes:

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

error: An empty identity is not valid when signing a binary for the product type 'Command-line Tool'. (in target 'CompilerIdC' from project 'CompilerIdC')

What's going on here, and how can I fix it?

like image 236
Bill Hollings Avatar asked Nov 29 '25 20:11

Bill Hollings


2 Answers

Update to at least cmake v3.23.3; cmake will internally set CODE_SIGN_IDENTITY to "-". Prior to v3.23.3, attempting to set CODE_SIGN_IDENTITY="-" still produced the empty identity error.

like image 56
Paul Kippes Avatar answered Dec 02 '25 21:12

Paul Kippes


I had run in to similar issue before and I don't remember exactly which one of these helped but hopefully one of these can help you:

  1. CODE_SIGN_IDENTITY issue in CMake - https://gitlab.kitware.com/cmake/cmake/-/issues/23609
  2. Download the xcode 14 beta command line tools from apple
  3. run sudo xcodebuild -license (https://stackoverflow.com/a/59556807)
  4. try setting it in your scripts: -DCMAKE_C_COMPILER="$(xcrun -find cc)" and -DCMAKE_CXX_COMPILER="$(xcrun -find c++)" (CMake error no CMAKE_C_COMPILER could be found using Xcode and GLFW)
like image 35
user1751536 Avatar answered Dec 02 '25 21:12

user1751536



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!