I'm trying to install OpenCV on my Mac by following this link
However, when I type cmake -G "Unix Makefiles" ..
on my terminal, this error is printed.
-- The CXX compiler identification is unknown -- The C compiler identification is unknown -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- broken CMake Error at /opt/local/share/cmake-3.0/Modules/CMakeTestCXXCompiler.cmake:54 (message): The C++ compiler "/usr/bin/c++" is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/kwmaeng/Desktop/opencv/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTryCompileExec653545098/fast"
make: error: unable to find utility "make", not a developer tool or in PATH
CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:56 (project)
-- Configuring incomplete, errors occurred! See also "/Users/kwmaeng/Desktop/opencv/build/CMakeFiles/CMakeOutput.log". See also "/Users/kwmaeng/Desktop/opencv/build/CMakeFiles/CMakeError.log".
So I checked CMakeError.log, and this is the content
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed. Compiler: /usr/bin/c++ Build flags: Id flags:
The output was: 72 xcodebuild: error: SDK "/Volumes/MAC/dev/adt-bundle-mac-x86_64-20131030/sdk" cannot be located. c++: error: unable to find utility "clang++", not a developer tool or in PATH ...(blah blah)
Weird thing is, /Volumes/MAC/dev/adt-bundle-mac-x86_64-20131030/sdk
is where my Android SDK had been installed, and it is deleted now, so there are no such folder anymore. Is the error occurring because cmake is referring to invalid path that does not exist anymore?? Why is cmake referring the location of android sdk in the first place?? Does it even matter to opencv??
I googled for hours but not much help was found. Please help me if you have any ideas.
Thanks in advance.
I had the same problem - what worked was to remove the command line tools:
rm -rf /Library/Developer/CommandLineTools
Then reinstall the command line tool:
xcode-select --install
Who knows what that script is doing...and I don't have time to investigate so there you go...
Thanks to everybody's help, I was able to solve my issue.
For other people who may suffer from the same problem in the future, this is what I did:
it was because my $PATH
was messed up (I think it happened when I tried to add Android SDK to $PATH
)
I cleared the .bash_profile
and added C++ and make and /opt/local/bin
, /opt/local/sbin
like this
export PATH=$PATH:/opt/local/bin:/opt/local/sbin:/usr/bin/c++:/usr/bin/make
and it worked like charm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With