+-
“ C编译器“ /usr/bin/c”无法编译简单的测试程序.”尝试安装OpenCV时
我正在尝试通过遵循此 link在Mac上安装OpenCV

但是,当我在终端上键入cmake -G“ Unix Makefiles” ..时,将显示此错误.

— 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”.

所以我检查了CMakeError.log,这是内容

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)

奇怪的是,/ Volumes / MAC / dev / adt-bundle-mac-x86_64-20131030 / sdk是我的Android SDK的安装目录,现在已删除,因此不再有这样的文件夹.是因为cmake指的是不再存在的无效路径而发生错误吗?为什么cmake首先要引用android sdk的位置?甚至对opencv都重要吗?

我用Google搜索了几个小时,但没有找到太多帮助.如果您有任何想法请帮助我.

提前致谢.

最佳答案
多亏了大家的帮助,我才得以解决我的问题.

对于将来可能会遇到相同问题的其他人,这是我所做的:

这是因为我的$PATH被弄乱了(我想是在我尝试将Android SDK添加到$PATH时发生的)

我清除了.bash_profile并添加了C并进行make和/ opt / local / bin,/ opt / local / sbin

像这样

export PATH=$PATH:/opt/local/bin:/opt/local/sbin:/usr/bin/c++:/usr/bin/make

它像魅力一样运作.

点击查看更多相关文章

转载注明原文:“ C编译器“ /usr/bin/c”无法编译简单的测试程序.”尝试安装OpenCV时 - 乐贴网