" C ++编译器"/usr/bin/c ++"无法编译简单的测试程序.尝试安装OpenCV时 [英] "The C++ compiler "/usr/bin/c++" is not able to compile a simple test program." When trying to install OpenCV
问题描述
I'm trying to install OpenCV on my Mac by following this link
但是,当我在终端上键入cmake -G "Unix Makefiles" ..
时,将显示此错误.
However, when I type cmake -G "Unix Makefiles" ..
on my terminal, this error is printed.
-CXX编译器标识未知 -C编译器标识未知 -检查可运行的CXX编译器:/usr/bin/c ++ -检查工作中的CXX编译器:/usr/bin/c ++-破碎的CMake错误位于/opt/local/share/cmake-3.0/Modules/CMakeTestCXXCompiler.cmake:54 (消息):C ++编译器"/usr/bin/c ++"无法编译 简单的测试程序.
-- 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:
更改目录:/Users/kwmaeng/Desktop/opencv/build/CMakeFiles/CMakeTmp
Change Dir: /Users/kwmaeng/Desktop/opencv/build/CMakeFiles/CMakeTmp
运行构建命令:"/usr/bin/make""cmTryCompileExec653545098/fast"
Run Build Command:"/usr/bin/make" "cmTryCompileExec653545098/fast"
make:错误:无法找到实用程序"make",而不是开发人员工具或 在PATH中
make: error: unable to find utility "make", not a developer tool or in PATH
CMake将无法正确生成此项目.称呼 堆栈(最新呼叫优先):CMakeLists.txt:56(项目)
CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:56 (project)
-配置不完整,发生了错误!另请参阅"/Users/kwmaeng/Desktop/opencv/build/CMakeFiles/CMakeOutput.log".看 还有"/Users/kwmaeng/Desktop/opencv/build/CMakeFiles/CMakeError.log".
-- 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,这就是内容
So I checked CMakeError.log, and this is the content
编译CXX编译器标识源文件 "CMakeCXXCompilerId.cpp"失败.编译器:/usr/bin/c ++生成标志: ID标志:
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed. Compiler: /usr/bin/c++ Build flags: Id flags:
输出为:72 xcodebuild:错误:SDK "/Volumes/MAC/dev/adt-bundle-mac-x86_64-20131030/sdk"不能为 位于. C ++:错误:无法找到实用程序"clang ++",而不是开发人员 工具或PATH中...(等等)
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都重要吗?
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??
我用Google搜索了几个小时,但没有找到太多帮助.如果您有任何想法,请帮助我.
I googled for hours but not much help was found. Please help me if you have any ideas.
谢谢.
推荐答案
感谢大家的帮助,我得以解决我的问题.
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:
这是因为我的$PATH
搞砸了(我认为是在我尝试将Android SDK添加到$PATH
时发生的)
it was because my $PATH
was messed up (I think it happened when I tried to add Android SDK to $PATH
)
我清除了.bash_profile
并添加了C ++以及make和/opt/local/bin
,/opt/local/sbin
I cleared the .bash_profile
and added C++ and make and /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时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!