OpenCV on Carma Kit (Tegra3 with Cuda) with GPU support


I’m trying to cross-compile OpenCV with CUDA support to activate gpu module, but I think that something is missing.

CMake configuration goes right, until it fails searching for
Since it is a library that on desktop Ubuntu systems is installed with developer driver, I searched for that file on Carma Kit filesystem, but I could not find it.

Do you know if the developer driver is installed on CarmaKit board?

Thank you

The current OpenCV GIT repository has changes for CARMA:

git clone git://
cd opencv

Most notably, OpenCV has a toolchain file for cross compiling:

cmake -DCMAKE_TOOLCHAIN_FILE=/modules/gpu/misc/carma.toolchain.cmake

note: the latest cmake is required when building OpenCV with CUDA, and cmake should be obtained from their website, the Ubuntu distribution version of cmake may not work for OpenCV with CUDA enabled.

ARM CUDA toolkit will need to be installed on the host.

there is a flag “WITH_NVCUVID” to disable the nvcuvid dependency.

Thank you for your reply.
I’m going to get latest trunk and to test the cross-compilation.

As host I’m using a Virtual Machine based on Ubuntu 11.04 32bit, according to a guide provided by Seco with CarmaKit.
Do you think that this is the best cobiguration to cross-compile?

Hi mfatica,

I followed the instructions for cross-compiling OpenCV with CUDA per . About 21% through the build I get an error @ the NVCC build state.

nvcc fatal : redefinition of argument ‘compiler-bindir’

I’ll probably start looking for the redefinition this weekend but I was wondering if anyone has had the same issue… I’m using a Natty distro and 64bit system (w/ ia32 libs installed).

That’s all for now, any help is appreciated.


Figured it out. I was using CCMake to try some different things and it was monkeying with some of the variables.

Also, if anyone reads this I would be curious as to if anyone has nvcc reject some architectures (21 & 35)

I had to use the following flags because nvcc wasn’t happy with anything else:


I’m pretty happy that people worked to get OpenCV compatible with the CARMA system so thank you very much to those that worked on the changes and documentation.

I have completed compiling opencv for Carma board with Cuda enable.

However when I tried to run a simple code, i always got segmentation errors. But if i just commented out gpu functions, the program run well.

Do you have any ideas about this issue?? Thanks Below is my sample code:

int main (int argc, char* argv)

{ try { gpu::getCudaEnabledDeviceCount(); Mat src_host = imread(“sample.bmp”, IMREAD_GRAYSCALE); gpu::GpuMat src,dst;


//gpu::cvtColor(src, dst, CV_YUV2RGB);


Mat result_host(src);

catch(const cv::Exception& ex)
cout <<“Exception happened\n”;

return 0;

Problem solved. Please refer to my blog if you face the same problem.