installing OpenCV with GPU modul in Mac

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

  1. Download and extract the source.
  2. Use Terminal, and create Build folder
  3. Use CMAKE GUI to configure
  4. Use Terminal and go to Build folder, then type make to compile
  5. Type sudo make install to install

And then, you may get this error :

[ 16%] Building NVCC (Device) object modules/ ... /cuda_compile_generated_matrix_
operations.cu.o
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 /usr/bin

#> 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 ! 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s