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.
The solution posted by @Marco was the one that worked for me. However, there is an additional note that should be made. Since we have compiled OpenCV with libstdc++ we will have to change our own apps to also link with this stdlib. 
If we try to compile without the libstdc++ flag we get the undefined symbols linking error, similar to this:

```
Undefined symbols for architecture x86_64:
    "cv::imwrite(cv::String const&, cv::_InputArray const&, std::__1::vector<int, std::__1::allocator<int> > const&)", referenced from:
    lbp::LBP::saveLBPImage(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in LBP.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

```