我正在尝试在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/