Can’t configure with cmake in Mac OS X 10.8 and Xcode 4.4

I just did a clean install of Mac OS X 10.8 Mountain Lion and Xcode 4.4 so when I was ready to compile (again…) OpenCV 2.4.2 I got this error executing “cmake ..”:

$ cmake ..
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:/Users/enekochan/compilaciones/OpenCV-2.4.2/build/CMakeFiles/CMakeCXXCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file:/Users/enekochan/compilaciones/OpenCV-2.4.2/build/CMakeFiles/CMakeCCompiler.cmake
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

New versions of Xcode (4.4 and above) don’t install themselves in /Developer so I thought it could be a path issue, but the real problem is that the terminal utilities are not included in the normal install of Xcode anymore. You can install them and agree ther terms from the command line:

sudo xcode-select --install
sudo xcodebuild -license

Or download them separately from https://developer.apple.com/downloads/ (you need an Apple ID). Then look for the latest “Command Line Tools” for your system:

Install it and you will be able to compile from the terminal.

Source: http://www.cmake.org/pipermail/cmake/2009-February/027317.html

You might also like

Install OpenCV 2.4.2 with ffmpeg support in Mac OS X 10.8
In order to install OpenCV 2.4.2 with ffmpeg support we have to first install lamemp3, faac, faad and...

Fix “OSX10.9.xctoolchain/usr/bin/cc: No such file or directory”
You may get this error while compiling something on the command line with Mac OS X:/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc:...

Install OpenCV 2.3.1a in Mac OS X 10.6
Download OpenCV 2.3.1a and unpack it: curl -L -O http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.3.1/OpenCV-2.3.1a.tar.bz2 tar...

Install OpenCV 2.3.1a in Mac OS X 10.6
Download OpenCV 2.3.1a and unpack it: curl -L -O http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.3.1/OpenCV-2.3.1a.tar.bz2 tar...

  1. You can also open XCode’s preferences -> downloads -> components, and click install on “Command Line Tools” and it’ll do everything for you.

  2. Thanks!! This finally solves my problem

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.