macos - 用cuda为MAC编译opencv

标签 macos opencv g++ clang

我正在尝试在Mac OS X中编译具有CUDA支持的opencv 2.4.5。我正在将cmake gui 2.8.10与Qt 4.8一起使用。
之后

clang: error: unsupported option '-dumpspecs' 
在make中,我将条目CUDA_HOST_COMPILER设置为/ usr / bin / llvm-g++。但是现在我收到此错误:
[ 16%] Built target IlmImf
[ 16%] Building NVCC (Device) object modules/core/CMakeFiles/cuda_compile.dir/src/cuda/./cuda_compile_generated_matrix_operations.cu.o
cc1plus: warning: command line option "-Wmissing-declarations" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
cc1plus: error: unrecognized command line option "-Wno-narrowing"
cc1plus: error: unrecognized command line option "-Wno-delete-non-virtual-dtor"
cc1plus: error: unrecognized command line option "-Wno-unnamed-type-template-args"
我现在能做什么?
系统设置
OS X 10.8.3 (12D78)
>>> clang --version
Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.3.0
Thread model: posix
>>> g++ --version
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
>>> ls -al /usr/bin/g++
/usr/bin/g++ -> llvm-g++-4.2
>>> cc --version
Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.3.0
Thread model: posix
>>> ls -al /usr/bin/cc
/usr/bin/cc -> clang

最佳答案

使用GCC和G++进行编译。我在OSX Mountain Lion上将CMake 2.8.11与最新的Xcode编译器一起使用:

g++ --version返回i686-apple-darwin11-llvm-g++-4.2(GCC)4.2.1(基于Apple Inc.内部版本5658)(LLVM内部版本2336.11.00)

将CUDA_HOST_COMPILER从/ usr / bin / cc更改为/ usr / bin / gcc

关于macos - 用cuda为MAC编译opencv,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16144966/

相关文章:

macos - 如何将stdout放入Console.app

c++ - 使用 gdb 在 Eclipse 中调试简单 C++ 时出现 "No source available for main()"错误

python - 如何在 Mac 上安装枕头?

android - OpenCV4Android 示例应用程序 - 此代码 fragment 的作用是什么?

node.js - 如何在 Windows 上的 Node.js 中获取文件的大小写精确路径?

c++ - 级联文件加载错误

python-2.7 - 使用opencv检测python中的圆形黑色 Blob

c++ - 如何将模板化成员函数专门化为 C++ 中的模板化类?

c++ - G++ 编译器 : Segfault handling

c++ - 编译器错误出现在一台特定机器上