Errors in building opencv using cmake in centos 7

I’m trying to build opencv using cmake commands in on my server. But it collapse in middle every time. You can see all the errors here. Please suggest something that can help me with this .
Thanks
Amit

please paste your errors here, not on an external bin, thank you

and post version information of your compiler/toolchain… because this indicates that your system/compiler/toolchain is too ancient.

Hi,
Here is the information about my system -

Static hostname: localhost.localdomain
Icon name: computer-server
Chassis: server
Machine ID: 8b34d46903a248ab800c255401cc1d04
Boot ID: 27761c9fa4fa470d8718cbbc3058262d
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-1160.24.1.el7.x86_64
Architecture: x86-64

gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Hi,
This is the error that I am encountering every time-

[ 36%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/shader/prior_box_spv.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/shader/relu_spv.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/shader/softmax_spv.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/buffer.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/context.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/internal.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/op_base.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/op_concat.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/op_conv.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/op_lrn.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/op_permute.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/op_pool.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/op_prior_box.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/op_relu.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/op_softmax.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/src/tensor.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/vulkan/vk_functions.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/vkcom/vulkan/vk_loader.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/opencl_kernels_dnn.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/layers/layers_common.avx.cpp.o
[ 37%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/layers/layers_common.avx2.cpp.o
[ 37%] Building CXX object modules/cudaarithm/CMakeFiles/opencv_cudaarithm.dir/src/arithm.cpp.o
[ 37%] Building CXX object modules/cudaarithm/CMakeFiles/opencv_cudaarithm.dir/src/core.cpp.o
[ 37%] Building CXX object modules/cudaarithm/CMakeFiles/opencv_cudaarithm.dir/src/lut.cpp.o
[ 37%] Building CXX object modules/cudaarithm/CMakeFiles/opencv_cudaarithm.dir/src/reductions.cpp.o
[ 37%] Building CXX object modules/cudaarithm/CMakeFiles/opencv_cudaarithm.dir/src/element_operations.cpp.o
In file included from /home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/private.cuda.hpp:73:0,
from /home/amit/Downloads/opencv_contrib-4.5.3/modules/cudaarithm/src/precomp.hpp:53,
from /home/amit/Downloads/opencv_contrib-4.5.3/modules/cudaarithm/src/arithm.cpp:43:
/home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/cuda/common.hpp: In function ‘void cv::cuda::device::bindTexture(const textureReference*, const cv::cuda::PtrStepSz<_Tp>&)’:
/home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/cuda/common.hpp:102:27: warning: ‘cudaError_t cudaBindTexture2D(size_t*, const textureReference*, const void*, const cudaChannelFormatDesc*, size_t, size_t, size_t)’ is deprecated (declared at /usr/local/cuda-11.4/include/cuda_runtime_api.h:8619) [-Wdeprecated-declarations]
cudaSafeCall( cudaBindTexture2D(0, tex, img.ptr(), &desc, img.cols, img.rows, img.step) );
^
/home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/cuda/common.hpp:74:58: note: in definition of macro ‘cudaSafeCall’
#define cudaSafeCall(expr) cv::cuda::checkCudaError(expr, FILE, LINE, CV_Func)
^
In file included from /home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/private.cuda.hpp:73:0,
from /home/amit/Downloads/opencv_contrib-4.5.3/modules/cudaarithm/src/precomp.hpp:53,
from /home/amit/Downloads/opencv_contrib-4.5.3/modules/cudaarithm/src/element_operations.cpp:43:
/home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/cuda/common.hpp: In function ‘void cv::cuda::device::bindTexture(const textureReference*, const cv::cuda::PtrStepSz<_Tp>&)’:
/home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/cuda/common.hpp:102:27: warning: ‘cudaError_t cudaBindTexture2D(size_t*, const textureReference*, const void*, const cudaChannelFormatDesc*, size_t, size_t, size_t)’ is deprecated (declared at /usr/local/cuda-11.4/include/cuda_runtime_api.h:8619) [-Wdeprecated-declarations]
cudaSafeCall( cudaBindTexture2D(0, tex, img.ptr(), &desc, img.cols, img.rows, img.step) );
^
/home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/cuda/common.hpp:74:58: note: in definition of macro ‘cudaSafeCall’
#define cudaSafeCall(expr) cv::cuda::checkCudaError(expr, FILE, LINE, CV_Func)
^
In file included from /home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/private.cuda.hpp:73:0,
from /home/amit/Downloads/opencv_contrib-4.5.3/modules/cudaarithm/src/precomp.hpp:53,
from /home/amit/Downloads/opencv_contrib-4.5.3/modules/cudaarithm/src/reductions.cpp:43:
/home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/cuda/common.hpp: In function ‘void cv::cuda::device::bindTexture(const textureReference*, const cv::cuda::PtrStepSz<_Tp>&)’:
/home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/cuda/common.hpp:102:27: warning: ‘cudaError_t cudaBindTexture2D(size_t*, const textureReference*, const void*, const cudaChannelFormatDesc*, size_t, size_t, size_t)’ is deprecated (declared at /usr/local/cuda-11.4/include/cuda_runtime_api.h:8619) [-Wdeprecated-declarations]
cudaSafeCall( cudaBindTexture2D(0, tex, img.ptr(), &desc, img.cols, img.rows, img.step) );
^
/home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/cuda/common.hpp:74:58: note: in definition of macro ‘cudaSafeCall’
#define cudaSafeCall(expr) cv::cuda::checkCudaError(expr, FILE, LINE, CV_Func)
^
In file included from /home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/private.cuda.hpp:73:0,
from /home/amit/Downloads/opencv_contrib-4.5.3/modules/cudaarithm/src/precomp.hpp:53,
from /home/amit/Downloads/opencv_contrib-4.5.3/modules/cudaarithm/src/core.cpp:43:
/home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/cuda/common.hpp: In function ‘void cv::cuda::device::bindTexture(const textureReference*, const cv::cuda::PtrStepSz<_Tp>&)’:
/home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/cuda/common.hpp:102:27: warning: ‘cudaError_t cudaBindTexture2D(size_t*, const textureReference*, const void*, const cudaChannelFormatDesc*, size_t, size_t, size_t)’ is deprecated (declared at /usr/local/cuda-11.4/include/cuda_runtime_api.h:8619) [-Wdeprecated-declarations]
cudaSafeCall( cudaBindTexture2D(0, tex, img.ptr(), &desc, img.cols, img.rows, img.step) );
^
/home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/cuda/common.hpp:74:58: note: in definition of macro ‘cudaSafeCall’
#define cudaSafeCall(expr) cv::cuda::checkCudaError(expr, FILE, LINE, CV_Func)
^
In file included from /home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/private.cuda.hpp:73:0,
from /home/amit/Downloads/opencv_contrib-4.5.3/modules/cudaarithm/src/precomp.hpp:53,
from /home/amit/Downloads/opencv_contrib-4.5.3/modules/cudaarithm/src/lut.cpp:5:
/home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/cuda/common.hpp: In function ‘void cv::cuda::device::bindTexture(const textureReference*, const cv::cuda::PtrStepSz<_Tp>&)’:
/home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/cuda/common.hpp:102:27: warning: ‘cudaError_t cudaBindTexture2D(size_t*, const textureReference*, const void*, const cudaChannelFormatDesc*, size_t, size_t, size_t)’ is deprecated (declared at /usr/local/cuda-11.4/include/cuda_runtime_api.h:8619) [-Wdeprecated-declarations]
cudaSafeCall( cudaBindTexture2D(0, tex, img.ptr(), &desc, img.cols, img.rows, img.step) );
^
/home/amit/Downloads/opencv-4.5.3/modules/core/include/opencv2/core/cuda/common.hpp:74:58: note: in definition of macro ‘cudaSafeCall’
#define cudaSafeCall(expr) cv::cuda::checkCudaError(expr, FILE, LINE, CV_Func)
^
[ 37%] Linking CXX shared library …/…/lib/libopencv_cudaarithm.so
[ 37%] Built target opencv_cudaarithm
[ 37%] Linking CXX shared library …/…/lib/libopencv_dnn.so
[ 37%] Built target opencv_dnn
[ 37%] Linking CXX executable …/…/bin/opencv_test_core
[ 37%] Built target opencv_test_core
make: *** [all] Error 2
(base) [amit@localhost build]$

throw that away. it’s too old.

centos 7 is ancient as well. you must upgrade to 8.

and replace those screenshots with text.

and format that text using the </> button in the toolbar of the post editor.