OpenCV 2.4.9 Won't Compile

I have L4T 21.1 with CUDA Toolkit 6.5 Installed.

I want to natively compile the normal OpenCV 2.4.9 (not opencv4tegra!).
I did the steps explained in the Jetson wiki, here:
But every time I try to execute make -j4 install, the operation terminates at the 84th percent, and says there’s a problem with a file in the source code:

/home/ubuntu/opencv-2.4.9/modules/gpu/src/nvidia/core/NCVPixelOperations.hpp(51): error: a storage class is not allowed in an explicit specialization

Before I flashed L4T 21.1 and installed CUDA 6.5, it went smoothly. This makes me suspect this is a configuration issue related to CUDA 6.5.

Any insights of how to solve this? Has anyone here succeeded in compiling OpenCV with L4T 21.1?

Thanks in advance,

The compilation problem can be solved by removing all the ‘static’ keywords in the template functions in that file.

However, from a short search online, it seems that the bug was fixed in a later branch that you can pull

Thanks. This fixed it.