Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake error no CMAKE_C_COMPILER could be found using Xcode and GLFW

Tags:

c++

xcode

cmake

I'm trying to follow this tutorial to get started with OpenGL: http://www.learnopengl.com/#!Getting-started/Creating-a-window and it requires downloading glfw and CMake. I have set the downloaded glfw folder as the source code folder and I have created inside that folder another one called "build" which I then set as the build one for the binaries, as the tutorial asks. I click on "Configure" and I select XCode as the Generator, since I'm on a Mac. The problem is that when I try to configure the project CMake gives me this error:

The C compiler identification is unknown CMake Error at CMakeLists.txt:3 (project): No CMAKE_C_COMPILER could be found.

Configuring incomplete, errors occurred! See also "/Users/standard/Desktop/glfw-3.2.1/build/CMakeFiles/CMakeOutput.log".

See also "/Users/standard/Desktop/glfw-3.2.1/build/CMakeFiles/CMakeError.log".

I've already read this question, but as far as I can understand, it doesn't have what I need: CMake Error at CMakeLists.txt:30 (project): No CMAKE_C_COMPILER could be found

Thank you.

like image 373
Jules Avatar asked Dec 29 '16 13:12

Jules


3 Answers

If you have installed Xcode or Command Line Tools for Xcode, try this:

sudo xcode-select --reset
like image 184
hstdt Avatar answered Nov 19 '22 10:11

hstdt


This happened to me with Xcode10 / Cmake 3.12 after installing Homebrew. Running sudo xcode-select --reset fixed it for me.

like image 29
op414 Avatar answered Nov 19 '22 09:11

op414


Did you install Xcode and Xcode Commandline Tools?

xcode-select --install

If you have Xcode Commandline Tools installed, you should no longer be receiving the xcrun is missing error.

How did you install Cmake? Once you have ensured that Xcode Commandline Tools is installed, please completely remove Cmake from your system and reinstall it. You have a screwed up configuration. There are ways to debug and fix it without a clean install, but since you are new to this, it will be the easiest and lest frustrating way.

Failing that if you do have Xcode Commandline Tools installed, hstdt suggested trying this:

sudo xcode-select --reset
like image 27
Cinder Biscuits Avatar answered Nov 19 '22 10:11

Cinder Biscuits