Error building with custom gstreamer

Hi everyone,

I am trying to build OpenCV 4.8.0 with GStreamer 1.20.7 and have run into errors linking with gstreamer:

FAILED: bin/opencv_visualisation 
: && /usr/bin/c++  -fsigned-char -ffast-math -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O2 -g -DNDEBUG  -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined apps/visualisation/CMakeFiles/opencv_visualisation.dir/opencv_visualisation.cpp.o  -o bin/opencv_visualisation -L/usr/local/cuda/lib64 -Wl,-rpath,/usr/local/cuda/lib64:/home/flir/opencv-builder/build/lib:  -ldl  -lm  -lpthread  -lrt  3rdparty/lib/libippiw.a  3rdparty/ippicv/ippicv_lnx/icv/lib/intel64/libippicv.a  -lcudart_static  -ldl  -lrt  -lnppc  -lnppial  -lnppicc  -lnppidei  -lnppif  -lnppig  -lnppim  -lnppist  -lnppisu  -lnppitc  -lnpps  -lcublas  -lcudnn  -lcufft  -L/usr/local/cuda/lib64  -L/usr/lib/x86_64-linux-gnu  lib/libopencv_highgui.so.4.8.0  lib/libopencv_videoio.so.4.8.0  lib/libopencv_imgcodecs.so.4.8.0  -lm  -lpthread  -lcudart_static  -lnppc  -lnppial  -lnppicc  -lnppidei  -lnppif  -lnppig  -lnppim  -lnppist  -lnppisu  -lnppitc  -lnpps  -lcublas  -lcudnn  -lcufft  lib/libopencv_imgproc.so.4.8.0  lib/libopencv_core.so.4.8.0  lib/libopencv_cudev.so.4.8.0 && :
/usr/bin/ld: warning: libgsttag-1.0.so.0, needed by /usr/local/gstreamer-1.20.7/lib/x86_64-linux-gnu/libgstriff-1.0.so.0, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: liborc-0.4.so.0, needed by /usr/local/gstreamer-1.20.7/lib/x86_64-linux-gnu/libgstvideo-1.0.so.0, not found (try using -rpath or -rpath-link)
/usr/bin/ld: /usr/local/gstreamer-1.20.7/lib/x86_64-linux-gnu/libgstpbutils-1.0.so.0: undefined reference to `gst_tag_list_to_vorbiscomment_buffer'
/usr/bin/ld: /usr/local/gstreamer-1.20.7/lib/x86_64-linux-gnu/libgstaudio-1.0.so.0: undefined reference to `orc_init'
/usr/bin/ld: /usr/local/gstreamer-1.20.7/lib/x86_64-linux-gnu/libgstaudio-1.0.so.0: undefined reference to `orc_target_get_name'
/usr/bin/ld: /usr/local/gstreamer-1.20.7/lib/x86_64-linux-gnu/libgstaudio-1.0.so.0: undefined reference to `gst_tag_register_musicbrainz_tags'
/usr/bin/ld: /usr/local/gstreamer-1.20.7/lib/x86_64-linux-gnu/libgstvideo-1.0.so.0: undefined reference to `orc_program_new_from_static_bytecode'
/usr/bin/ld: /usr/local/gstreamer-1.20.7/lib/x86_64-linux-gnu/libgstriff-1.0.so.0: undefined reference to `gst_tag_freeform_string_to_utf8'
/usr/bin/ld: /usr/local/gstreamer-1.20.7/lib/x86_64-linux-gnu/libgstvideo-1.0.so.0: undefined reference to `orc_program_free'
/usr/bin/ld: /usr/local/gstreamer-1.20.7/lib/x86_64-linux-gnu/libgstaudio-1.0.so.0: undefined reference to `orc_target_get_flag_name'
/usr/bin/ld: /usr/local/gstreamer-1.20.7/lib/x86_64-linux-gnu/libgstvideo-1.0.so.0: undefined reference to `orc_once_mutex_unlock'
/usr/bin/ld: /usr/local/gstreamer-1.20.7/lib/x86_64-linux-gnu/libgstaudio-1.0.so.0: undefined reference to `orc_target_get_default'
/usr/bin/ld: /usr/local/gstreamer-1.20.7/lib/x86_64-linux-gnu/libgstvideo-1.0.so.0: undefined reference to `orc_program_compile'
/usr/bin/ld: /usr/local/gstreamer-1.20.7/lib/x86_64-linux-gnu/libgstvideo-1.0.so.0: undefined reference to `orc_program_set_backup_function'
/usr/bin/ld: /usr/local/gstreamer-1.20.7/lib/x86_64-linux-gnu/libgstvideo-1.0.so.0: undefined reference to `orc_once_mutex_lock'
/usr/bin/ld: /usr/local/gstreamer-1.20.7/lib/x86_64-linux-gnu/libgstvideo-1.0.so.0: undefined reference to `orc_program_take_code'
/usr/bin/ld: /usr/local/gstreamer-1.20.7/lib/x86_64-linux-gnu/libgstaudio-1.0.so.0: undefined reference to `orc_target_get_default_flags'
/usr/bin/ld: /usr/local/gstreamer-1.20.7/lib/x86_64-linux-gnu/libgstaudio-1.0.so.0: undefined reference to `orc_memset'

I am building an a docker container based off of nvidia/cuda:11.4.3-cudnn8-devel-ubuntu20.04, and my custom gstreamer build, is installed at /usr/local/gstreamer-1.20.7. My CMake command line is as follows:

cmake \
    -D CMAKE_BUILD_TYPE=RelWithDebInfo \
    -D OPENCV_EXTRA_MODULES_PATH=../externs/opencv_contrib/modules \
    -D OPENCV_DNN_CUDA=ON \
    -D ENABLE_FAST_MATH=ON \
    -D CUDA_FAST_MATH=ON \
    -D WITH_CUDA=ON \
    -D WITH_CUDNN=ON \
    -D WITH_TBB=ON \
    -D WITH_CUBLAS=ON \
    -D WITH_LIBV4L=ON \
    -D WITH_V4L=ON \
    -D WITH_GSTREAMER=ON \
    -D BUILD_opencv_python3=ON \
    -D BUILD_TESTS=OFF \
    -D BUILD_PERF_TESTS=OFF \
    -D INSTALL_PYTHON_EXAMPLES=OFF \
    -D INSTALL_C_EXAMPLES=OFF \
    -D BUILD_EXAMPLES=OFF \
    -G Ninja \
    ../externs/opencv

I have verified that both libgsttag-1.0.so.0 and liborc-0.4.so.0 exist under /usr/local/gstreamer-1.20.7.

Could someone help me to figure out how to fix this?

Thank you,
Cameron McQuinn