I was trying to install OpenCV 2.4.5 with GPU modul in Mac OSX Mountain Lion (10.8.4) but got some errors. Trying to find solution through Google, but didn’t get much information. Finally, after couple hours, I got the idea, it’s coming from several sources, so I just collect them here to help others who may need this.
Follow instructions in OpenCV_GPU
- Download and extract the source.
- Use Terminal, and create Build folder
- Use CMAKE GUI to configure
- Use Terminal and go to Build folder, then type
make to compile
sudo make install to install
And then, you may get this error :
[ 16%] Building NVCC (Device) object modules/ ... /cuda_compile_generated_matrix_
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"
Solution : Actually, it’s because in Mac use llvm-gcc compiler. So, you have to download the “TRUE” gcc compiler via MacPort. If you don’t have MacPort yet, don’t be lazy, just Google-ing how to install it. 😀 I use gcc 4.6.4, but you can try the latest one if you already have.
sudo port install gcc46
By default, anything you’ve installed via MacPort will go to
/opt/local/bin/. So, you have to make a symbolic link to gcc in
#> sudo unlink /usr/bin/gcc
#> sudo ln -s /opt/local/bin/x86_64-apple-darwin12-gcc-4.6.4 /usr/bin/gcc
and try to compile again.
If you get error like this.
Undefined symbols for architecture x86_64:
"std::ctype<char>::_M_widen_init() const", referenced from:
stdDebugOutput(cv::String const&) in cuda_compile_generated_NCV.cu.o
ld: symbol(s) not found for architecture x86_64
Keep calm, and follow solution below. 😀
Solution : You need to set “-fno-inline” flag in CMAKE_CXX_FLAGS. Open your CMAKE GUI, put a checklist in “Advanced“, you’ll see CMAKE_CXX_FLAGS attribute name.
It should be okay, now ! 🙂