Question: After updating my OSX to 10.9 (Maverick), I cannot compile OpenCV with CUDA support. I was able to install the CUDA SDK and compile and run all samples, so it is not a CUDA problem.

I receive the following error:

```
[ 22%] Built target IlmImf
[ 22%] Building NVCC (Device) object modules/core/CMakeFiles/cuda_compile.dir/src/cuda/./cuda_compile_generated_matrix_operations.cu.o
clang: error: unsupported option '-dumpspecs'
clang: error: no input files
CMake Error at cuda_compile_generated_matrix_operations.cu.o.cmake:206 (message):
Error generating
/Users/josericardo/Downloads/opencv-2.4.6.1/build/modules/core/CMakeFiles/cuda_compile.dir/src/cuda/./cuda_compile_generated_matrix_operations.cu.o

```

Does anyone have this problem? I've searched on the net about this specific error (some suggestions for previous error like this do exist but not for this one), but without success.

Thanks so much!

Answer: 
It's an "old" problem that has appeared since the default compiler is `llvm` instead of `gcc` on Mac and it happens on OSX 10.8 too.

**Pre-requisite:** if you are using a new Mac, or a Mac where the developer tools were never installed until recently (say, 3 or 4 months ago), then you want to check if `gcc/g++` is installed on the machine by examining the content of `/usr/bin`.

If `gcc/g++` are not installed, then you need to install them via, e.g., [homebrew](http://brew.sh).

**Cmake setup:** in the `cmake` settings, make sure that both the C and C++ CUDA host compilers are set to your install of `gcc/g++`, usually in `/usr/local/bin`. Some helpful information can be found in [this question](https://stackoverflow.com/questions/16286588/cuda-5-0-cmake-and-make-failing-on-osx-10-8-3?rq=1) too.
OK, I managed to get it to work on my machine after a couple of hard working days.

I used the git version of Opencv 2.4 but I suppose it is not so different from the version you're using.

The problems I had were the following:

* On Mac 10.9, gcc has been dropped from the distribution in profit of clang. However, CUDA refuses to be used by clang. Even setting CUDA\_HOST\_COMPILER to a gcc version in cmake is not enough because the linking will be done by the main compiler and does not work with clang. Furthermore CUDA does not accept a gcc version >= 4.7. Long story short I installed an older version of gcc with macports to compile all the library.
* Problem if you use gcc instead of clang is that the call to the newest framework of QTKit (QuickTimeKit) does not compile anymore, so I had to deactivate it (you can change it in OpenCVFindLibsVideo.cmake -> set(HAVE\_QTKIT NO) ).
* I also had to install Qt5 in order to have a working GUI (otherwise the highgui module would not compile, which includes the 'imload' and 'imwrite' functions)
* Also do not use cmake 2.8.12 but 2.8.11 which has a bug for some linker options -> <http://comments.gmane.org/gmane.comp.programming.tools.cmake.user/48007>
* You also have to set CMAKE\_SYSTEM\_PROCESSOR. If unset it generates an error in FindCUDA.cmake lines 762 and 770.

Probably I forgot a couple of things, I think I had to deactivate ffmpeg as well. That was pretty difficult in the end, but everything seems to work now :-)