OpenCV can be compiled from source easily on Ubuntu as explained here. By default, if you have CUDA installed on your Ubuntu, OpenCV will compiled with CUDA support enabled. This can increase the compilation time of OpenCV from a few minutes to several hours! If you don't need the CUDA support and don't want to wait that long to compile OpenCV, then it might be better to compile OpenCV with CUDA support turned off.
To disable CUDA support in OpenCV, add
-D WITH_CUDA=OFF to the cmake compilation string used to compile OpenCV.
Tried with: CUDA 5.0, OpenCV 2.4.9 and Ubuntu 12.04 LTS