Errors building OpenCV 4.6 with CUDA

I’m trying to build opencv with cuda enabled using cuda 12. I am using gcc 7.3 and my cmake options related to CUDA are
-D WITH_CUDA=ON -D WITH_CUDNN=ON -D OPENCV_DNN_CUDA=ON
I get the following error
[ 18%] Built target IlmImf
[ 18%] Linking CXX shared library …/…/lib/libopencv_core.so
/opt/utas_toolchain-01.006/lib/gcc/x86_64-unknown-linux-gnu/7.3.0/…/…/…/…/x86_64-unknown-linux-gnu/bin/ld: /usr/local/cuda/lib64/libcudart_static.a(c udart_static.o): unrecognized relocation (0x2a) in section `.text’
/opt/utas_toolchain-01.006/lib/gcc/x86_64-unknown-linux-gnu/7.3.0/…/…/…/…/x86_64-unknown-linux-gnu/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status

Can you post all your options and the output from CMake please.

cmake
-D CMAKE_BUILD_TYPE=Release
-D BUILD_opencv_java=OFF
-D BUILD_opencv_python2=OFF
-D BUILD_opencv_python3=OFF
-D BUILD_JPEG=ON
-D BUILD_PNG=ON
-D BUILD_TIFF=ON
-D BUILD_JASPER=ON
-D BUILD_ZLIB=ON
-D WITH_GTK=OFF
-D OPENCV_EXTRA_MODULES_PATH=…/opencv_contrib-4.x/modules
-D DOPENCV_TEST_DATA_PATH=…/opencv_extra/testdata
-D BUILD_opencv_world=OFF
-D WITH_CUDA=ON
-D WITH_CUDNN=ON
-D OPENCV_DNN_CUDA=ON
-D WITH_GSTREAMER=OFF
-D TBB_INCLUDE_DIRS=%{input_toolchain}/include
-D TBB_LIB_DIR=%{input_toolchain}/lib
-D TBB_STDDEF_PATH=%{input_toolchain}/include/tbb/tbb_stddef.h
-D WITH_TBB=ON
-D WITH_NVCUVID=OFF
-D ENABLE_FAST_MATH=1
-D CUDA_FAST_MATH=1
-D WITH_CUBLAS=1
-D WITH_OPENMP=ON
-D WITH_VA=OFF
-D WITH_PROTOBUF=OFF
-D CMAKE_INSTALL_PREFIX=%{_prefix}

I am having issues copying the cmake output due to size limitations

OK, I didn’t want all the output just the main config.

I haven’t seen these errors before but Google recommends upgrading binutils which may be applicatble as you have an older version of gcc.