Installing and Compiling OpenCV in L4T 21.x

Hello folks!

I might be missing something, but I’m trying to compile OpenCV following the guidelines from the However I’m getting the following error.

[ 75%] Building CXX object apps/traincascade/CMakeFiles/opencv_traincascade.dir/imagestorage.cpp.o
Linking CXX executable ../../bin/opencv_traincascade
[ 75%] Built target opencv_traincascade
make[1]: *** [modules/gpu/CMakeFiles/opencv_gpu.dir/all] Error 2
make: *** [all] Error 2

In both L4T 21.1 and L4T 21.2 I’m getting the same error. However in L4T 21.2 the error appears around at 85%. I’m compiling the library because I’m using some libraries that are not prebuilt version.

Any help will be highly appreciated.

Thank you beforehand folks!

The instructions on the Jetson wiki are for LT4 19.3

OpenCV 2.4.9 has issues with CUDA 6.5 provided with LT4 21.X. You probably saw the error:

NVCPixelOperation.hpp error: A storage class is not allowed in an explicit specialization

OpenCV 2.4.10 is compatible with CUDA 6.5. You can get OpenCV 2.4.10 from the OpenCV website or from Github. OpenCV website:

Well… I went back to the L4T R19, I’ll see if there is a bug, probably I did not follow up all the steps correctly. I’ll try it again soon. Thank you.

Worked with my Jetson L4T 21.2. Thanks a lot!

You may try to cross compile, refer to following instruction: