Error: No Cuda support

Description

I developed a plugin and running perfectly using gstreamer pipeline script:

gst-launch-1.0 filesrc location= /data/agx/al.h264 ! h264parse ! nvv4l2decoder ! nvvideoconvert nvbuf-memory-type=3 ! m.sink_0 nvstreammux name=m batch-size=1 width=1920 height=1080 !
nvinfer config-file-path= dstest1_pgie_config.txt ! nvvideoconvert !
my_plugin ! nvdsosd ! nveglglessink sync=False

Then I write up an gst_app.c which is exactly mimic the above pipeline and compile successfully.

When I run, it reports the following error:

OpenCV Error: No CUDA support (The library is compiled without CUDA support) in throw_no_cuda, file /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/include/opencv2/core/private.cuda.hpp, line 97
terminate called after throwing an instance of ‘cv::Exception’
what(): /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/include/opencv2/core/private.cuda.hpp:97: error: (-216) The library is compiled without CUDA support in function throw_no_cuda

This looks like that “my_plugin” cannot bind with cuda opencv lib. But when I run the gstreamer script above it works (which implies “my_plugin” can bind with cuda opencv lib.

Question: does gst_app need to bind with cuda opencv lib? (if yes, I don’t understand why. Inside gst_app.c, my_plugin just like any other element such as nvinfer, etc. which no need to be “recompiled”) Or do I need to setup certain environment variable such as GST_PLUGIN_SYSTEM_PATH, etc? (why doesn’t need to when run the above pipeline script?) what am I missing?

Please advise. Thanks a lot for your help.

Environment

GPU Type: 1080Ti
Nvidia Driver Version: 450.80.02
CUDA Version: 10.2
Operating System + Version: Docker/Ubuntu 18.04

It turns out to be I have two lines of code in “my_plugin” which requires cuda:

gpu_xmap.upload(xmap);
gpu_ymap.upload(ymap);

which no longer needed and I comment them out and recompile “my_plugin” that solves the problem. But still don’t know why the script run without this fix.