OpenCV4Tegra on TX2

I have ported some code that ran successful on the TX1 over to the TX2. I’m getting the following error when I try to access the GPU.

OpenCV Error: Gpu API call (invalid device symbol) in linearRow, file /hdd/buildbot/slave_jetson_tx_3/35-O4T-L4T-R24/opencv/modules/gpu/src/cuda/row_filter.h, line 552
terminate called after throwing an instance of 'cv::Exception'
  what():  /hdd/buildbot/slave_jetson_tx_3/35-O4T-L4T-R24/opencv/modules/gpu/src/cuda/row_filter.h:552: error: (-217) invalid device symbol in function linearRow

Most articles online say this error is related to OpenCV being built with the wrong architecture and the fix set CUDA_GENERATION=AUTO during the OpenCV build process. Unfortunately, I’m trying use OpenCV4Tegra 2.4.13 and you don’t build this from source.

ubuntu@tx2-u1604-b:~/GFBTracker_GPU/staExec$ pkg-config --modversion opencv
2.4.13

I cleaned and built my code from scratch after the port and the CPU version works fine. The exact function it breaks on is cv::gpu::cornerHarris.

Has anyone had a similar issue or have any ideas to try?

I think I found the issue here

https://devtalk.nvidia.com/default/topic/1000106/?comment=5114203

Does anyone know a way to compile OpenCV 2.4.X from source, while still using the optimized OpenCV4Tegra functions?

You may read this: https://devtalk.nvidia.com/default/topic/1000644/jetson-tx1/recompiling-opencv4tegra-with-gstreamer-support/post/5112639/#5112639