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

installing cuda 5 on ubuntu 12.04

  1. Download CUDA 5 installers from
  2. Add execution mode to the run file.
    • $ chmod +x cuda_5.*.run
  3. Change to terminal mode Ctrl-Alt-F1, log on and type
    • $ sudo service lightdm stop
    • $ sudo ./cuda_5.*.run
    • $ sudo shutdown -r now

If you failed to get back to login gui, type this:

  • $ sudo apt-get purge nvidia*
  • $ sudo apt-get install nvidia-current-updates-dev

errors in cuda 4.0

I’m just trying the cuda 4.0 on my macbook. And, as usual, i’m too lazy to read the “what’s new” page or doc. Just go straight to test it until got stuck with the errors.. 😀

Here, I’ll list any kind of errors i experienced with, and hopefully it’ll come along with solution.. 😛

First, i’m trying to compile an old simple code. This code was fine using cuda 3.2, but when I compile it using cuda 4.0, this kind of error comes out..

cudaLK.o:1203:53: warning: null character(s) ignored
cudaLK.o:1203:101: warning: null character(s) ignored
cudaLK.o:1203:112: warning: null character(s) preserved in literal
cudaLK.o:1203:112: warning: missing terminating ' character
cudaLK.o(1): error: unrecognized token

whoaa…… this forced me to read the programming guide, again..

Finally, when my eyes went to nvcc section, I got the clue… It looks like nvidia change the format of nvcc command.. In earlier version, simple nvcc command was

nvcc -c <cudacodefile>.cu -o <cudacodefile>.o

But for cuda 4.0, you don’t need to define the object file. nvcc will automatically define the object file based on the .cu file name. So, it should be simply..

nvcc -c <cudacodefile>.cu

to be continued later..

portable version of GPU Caps Viewer

GPU Caps Viewer is a tool to see your graphics card information with focus on the OpenGL, OpenCL, and CUDA API level support. It’s developed by Geeks3D and unfortunately only support Win 32-bit. ( no linux there 😦 )

The latest version (1.9.4 released on 2010.11.05) can be downloaded here. Continue reading

disabling nouveau kernel driver

Cuma catetan dikit ttg linux (fedora 11 ke atas) biar gampang nyari. Baru tau kalo ternyata mulai dari kernel 2.6.33 ke atas, di dalamnya udah terdapat open graphics driver yang compatible ama GeForce, namanya, “nouveau”. Sebenarnya sih, hal ini menguntungkan karna kita tidak perlu repot lagi nyari-nyari driver buat VGA. Tetapi untuk beberapa keperluan yang berkaitan langsung dengan fitur keluaran NVIDIA yang memerlukan official driver dari NVIDIA, seperti CUDA, hal ini jadi masalah. nouveau akan menghalangi proses instalasi driver.

Therefore, we have to disable the nouveau kernel driver. We just need to add following to the “kernel” line in grub.conf (/etc/grub.conf or /boot/grub/grub.conf)


the grub.conf will then look like

title Fedora (
	root (hd0,2)
	kernel /vmlinuz- ro root=/dev/mapper/vg_satriahost-lv_root  LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet rdblacklist=nouveau
	initrd /initramfs-

After reboot, you can install the official NVIDIA driver.


another kotretan..

  1. Double data type is only supported on CUDA device which has compute capability 1.3. Use device query application to check your device capability.
  2. The following error message often appears when compiling a CUDA file (*.cu) in Visual C++ Express on a XP 64-bit machine and using CUDA toolkit 64-bit.
  3. "fatal error LNK1112: module machine type 'X64' conflicts with target machine type 'x86'"

    By default, Visual Express can only compile your program as 32-bit application. Since our CUDA toolkit type is 64-bit, then nvcc will compile your CUDA file as a 64-bit application. So, the error message warns this mismatch.

    To solve this, we have to add an extra option on NVCC when compiling a CUDA file. Go to Properties of our project, then in CUDA Build Rule v3.x.x >> General, add “–machine 32” (without quotation mark) in Extra Options column.