Issue 1:
System information (version)

OpenCV => master

Operating System / Platform => Manjaro Linux (testing)

Compiler => gcc 11.2.0

Detailed description

[ 25%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/halide_scheduler.cpp.o
In file included from opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg.cpp:50:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:542:5: error: ‘AVBSFContext’ does not name a type; did you mean ‘AVIOContext’?
542 | AVBSFContext* bsfc;
| ^~~~~~~~~~~~
| AVIOContext
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘void CvCapture_FFMPEG::init()’:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:589:5: error: ‘bsfc’ was not declared in this scope
589 | bsfc = NULL;
| ^~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘void CvCapture_FFMPEG::close()’:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:620:34: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
620 | avcodec_close( video_st->codec );
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:655:9: error: ‘bsfc’ was not declared in this scope
655 | if (bsfc)
| ^~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:658:9: error: ‘av_bsf_free’ was not declared in this scope; did you mean ‘av_opt_free’?
658 | av_bsf_free(&bsfc);
| ^~~~~~~~~~~
| av_opt_free
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: At global scope:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:803:39: error: ‘AVLockOp’ has not been declared
803 | static int LockCallBack(void **mutex, AVLockOp op)
| ^~~~~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In function ‘int LockCallBack(void**, int)’:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:808:14: error: ‘AV_LOCK_CREATE’ was not declared in this scope; did you mean ‘AV_LOG_TRACE’?
808 | case AV_LOCK_CREATE:
| ^~~~~~~~~~~~~~
| AV_LOG_TRACE
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:817:14: error: ‘AV_LOCK_OBTAIN’ was not declared in this scope
817 | case AV_LOCK_OBTAIN:
| ^~~~~~~~~~~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:821:14: error: ‘AV_LOCK_RELEASE’ was not declared in this scope
821 | case AV_LOCK_RELEASE:
| ^~~~~~~~~~~~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:825:14: error: ‘AV_LOCK_DESTROY’ was not declared in this scope
825 | case AV_LOCK_DESTROY:
| ^~~~~~~~~~~~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In constructor ‘InternalFFMpegRegister::InternalFFMpegRegister()’:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:885:9: error: ‘av_register_all’ was not declared in this scope
885 | av_register_all();
| ^~~~~~~~~~~~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:888:9: error: ‘av_lockmgr_register’ was not declared in this scope
888 | av_lockmgr_register(&LockCallBack);
| ^~~~~~~~~~~~~~~~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In destructor ‘InternalFFMpegRegister::~InternalFFMpegRegister()’:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:892:9: error: ‘av_lockmgr_register’ was not declared in this scope
892 | av_lockmgr_register(NULL);
| ^~~~~~~~~~~~~~~~~~~
In file included from opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg.cpp:50:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvCapture_FFMPEG::open(const char*, const cv::VideoCaptureParameters&)’:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1004:42: error: invalid conversion from ‘const AVInputFormat*’ to ‘AVInputFormat*’ [-fpermissive]
1004 | input_format = av_find_input_format(entry->value);
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
| |
| const AVInputFormat*
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1023:47: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
1023 | AVCodecContext* enc = ic->streams[i]->codec;
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1109:53: error: invalid conversion from ‘const AVCodec*’ to ‘AVCodec*’ [-fpermissive]
1109 | codec = avcodec_find_decoder(enc->codec_id);
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
| |
| const AVCodec*
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1118:61: error: invalid conversion from ‘const AVCodec*’ to ‘AVCodec*’ [-fpermissive]
1118 | codec = avcodec_find_decoder_by_name(video_codec_param->value);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| const AVCodec*
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvCapture_FFMPEG::processRawPacket()’:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1238:19: error: ‘AVBitStreamFilter’ does not name a type
1238 | const AVBitStreamFilter * bsf = av_bsf_get_by_name(filterName);
| ^~~~~~~~~~~~~~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1239:18: error: ‘bsf’ was not declared in this scope
1239 | if (!bsf)
| ^~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1244:36: error: ‘bsf’ was not declared in this scope
1244 | int err = av_bsf_alloc(bsf, &bsfc);
| ^~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1244:42: error: ‘bsfc’ was not declared in this scope
1244 | int err = av_bsf_alloc(bsf, &bsfc);
| ^~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1244:23: error: ‘av_bsf_alloc’ was not declared in this scope; did you mean ‘av_max_alloc’?
1244 | int err = av_bsf_alloc(bsf, &bsfc);
| ^~~~~~~~~~~~
| av_max_alloc
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1251:19: error: ‘av_bsf_init’ was not declared in this scope; did you mean ‘av_uninit’?
1251 | err = av_bsf_init(bsfc);
| ^~~~~~~~~~~
| av_uninit
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1267:9: error: ‘bsfc’ was not declared in this scope
1267 | if (bsfc)
| ^~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1275:19: error: ‘av_bsf_send_packet’ was not declared in this scope; did you mean ‘avcodec_send_packet’?
1275 | int err = av_bsf_send_packet(bsfc, &packet);
| ^~~~~~~~~~~~~~~~~~
| avcodec_send_packet
[ 25%] Building CXX object modules/xphoto/CMakeFiles/opencv_xphoto.dir/src/inpainting.cpp.o
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1281:15: error: ‘av_bsf_receive_packet’ was not declared in this scope; did you mean ‘avcodec_receive_packet’?
1281 | err = av_bsf_receive_packet(bsfc, &packet_filtered);
| ^~~~~~~~~~~~~~~~~~~~~
| avcodec_receive_packet
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvCapture_FFMPEG::grabFrame()’:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1325:45: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
1325 | valid = avcodec_receive_frame(video_st->codec, picture) >= 0;
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1375:43: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
1375 | if (avcodec_send_packet(video_st->codec, &packet) < 0) {
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1378:47: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
1378 | ret = avcodec_receive_frame(video_st->codec, picture);
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1387:40: error: ‘AVFrame’ {aka ‘struct AVFrame’} has no member named ‘pkt_pts’; did you mean ‘pkt_dts’?
1387 | picture_pts = picture->pkt_pts != AV_NOPTS_VALUE_ && picture->pkt_pts != 0 ? picture->pkt_pts : picture->pkt_dts;
| ^~~~~~~
| pkt_dts
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1387:79: error: ‘AVFrame’ {aka ‘struct AVFrame’} has no member named ‘pkt_pts’; did you mean ‘pkt_dts’?
1387 | picture_pts = picture->pkt_pts != AV_NOPTS_VALUE_ && picture->pkt_pts != 0 ? picture->pkt_pts : picture->pkt_dts;
| ^~~~~~~
| pkt_dts
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1387:103: error: ‘AVFrame’ {aka ‘struct AVFrame’} has no member named ‘pkt_pts’; did you mean ‘pkt_dts’?
1387 | picture_pts = picture->pkt_pts != AV_NOPTS_VALUE_ && picture->pkt_pts != 0 ? picture->pkt_pts : picture->pkt_dts;
| ^~~~~~~
| pkt_dts
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvCapture_FFMPEG::retrieveFrame(int, unsigned char**, int*, int*, int*, int*)’:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1425:27: error: ‘bsfc’ was not declared in this scope
1425 | AVPacket& p = bsfc ? packet_filtered : packet;
| ^~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1431:48: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
1431 | *data = ic->streams[video_stream]->codec->extradata;
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1432:48: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
1432 | *step = ic->streams[video_stream]->codec->extradata_size;
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1457:34: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
1457 | frame.width != video_st->codec->width ||
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1458:35: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
1458 | frame.height != video_st->codec->height ||
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1463:38: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
1463 | int buffer_width = video_st->codec->coded_width, buffer_height = video_st->codec->coded_height;
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1467:31: error: ‘buffer_height’ was not declared in this scope; did you mean ‘buffer_width’?
1467 | buffer_width, buffer_height,
| ^~~~~~~~~~~~~
| buffer_width
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1497:33: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
1497 | frame.width = video_st->codec->width;
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1498:34: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
1498 | frame.height = video_st->codec->height;
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1508:26: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
1508 | 0, video_st->codec->coded_height,
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvCapture_FFMPEG::retrieveHWFrame(cv::OutputArray)’:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1537:44: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
1537 | return hw_copy_frame_to_umat(video_st->codec->hw_device_ctx, picture, output);
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘double CvCapture_FFMPEG::getProperty(int) const’:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1573:30: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
1573 | codec_id = video_st->codec->codec_id;
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1574:40: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
1574 | codec_tag = (double) video_st->codec->codec_tag;
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1594:43: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
1594 | AVPixelFormat pix_fmt = video_st->codec->pix_fmt;
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1603:29: error: ‘bsfc’ was not declared in this scope
1603 | const AVPacket& p = bsfc ? packet_filtered : packet;
| ^~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘double CvCapture_FFMPEG::get_fps() const’:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1674:52: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
1674 | fps = 1.0 / r2d(ic->streams[video_stream]->codec->time_base);
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘void CvCapture_FFMPEG::seek(int64_t)’:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1731:58: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
1731 | avcodec_flush_buffers(ic->streams[video_stream]->codec);
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In function ‘bool icv_configure_video_stream_FFMPEG(AVFormatContext*, AVStream*, const AVCodec*, int, int, int, double, AVPixelFormat)’:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1966:29: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
1966 | AVCodecContext *c = st->codec;
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:1974:5: error: ‘avcodec_get_context_defaults3’ was not declared in this scope
1974 | avcodec_get_context_defaults3(c, codec);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In function ‘int icv_av_write_frame_FFMPEG(AVFormatContext*, AVStream*, uint8_t*, uint32_t, AVFrame*, int)’:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:2081:35: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
2081 | AVCodecContext* c = video_st->codec;
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvVideoWriter_FFMPEG::writeFrame(const unsigned char*, int, int, int, int, int)’:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:2180:35: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
2180 | AVCodecContext* c = video_st->codec;
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:2258:19: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
2258 | if (video_st->codec->hw_device_ctx) {
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:2265:45: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
2265 | if (av_hwframe_get_buffer(video_st->codec->hw_frames_ctx, hw_frame, 0) < 0) {
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvVideoWriter_FFMPEG::writeHWFrame(cv::InputArray)’:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:2294:20: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
2294 | if (!video_st->codec->hw_frames_ctx)
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:2302:41: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
2302 | if (av_hwframe_get_buffer(video_st->codec->hw_frames_ctx, hw_frame, 0) < 0) {
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:2308:42: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
2308 | if (!hw_copy_umat_to_frame(video_st->codec->hw_device_ctx, input, hw_frame)) {
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘void CvVideoWriter_FFMPEG::close()’:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:2383:19: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
2383 | if( video_st->codec->pix_fmt != input_pix_fmt)
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:2395:29: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
2395 | avcodec_close(video_st->codec);
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvVideoWriter_FFMPEG::open(const char*, int, double, int, int, const cv::VideoWriterParameters&)’:
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:2522:26: error: invalid conversion from ‘const AVOutputFormat*’ to ‘AVOutputFormat*’ [-fpermissive]
2522 | fmt = av_guess_format(NULL, filename, NULL);
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
| |
| const AVOutputFormat*
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:2602:18: error: ‘AVFormatContext’ {aka ‘struct AVFormatContext’} has no member named ‘filename’
2602 | snprintf(oc->filename, sizeof(oc->filename), "%s", filename);
| ^~~~~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:2602:39: error: ‘AVFormatContext’ {aka ‘struct AVFormatContext’} has no member named ‘filename’
2602 | snprintf(oc->filename, sizeof(oc->filename), "%s", filename);
| ^~~~~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:2718:58: error: ‘AVFormatContext’ {aka ‘struct AVFormatContext’} has no member named ‘filename’
2718 | codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);
| ^~~~~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:2736:35: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
2736 | AVCodecContext *c = video_st->codec;
| ^~~~~
opencv-git/src/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:2769:41: error: invalid conversion from ‘const AVCodec*’ to ‘AVCodec*’ [-fpermissive]
2769 | codec = avcodec_find_encoder(codec_id);
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
| |
| const AVCodec*

Steps to reproduce

cd opencv-git/build

cmake -DWITH_OPENCL=ON \
-DWITH_OPENGL=ON \
-DWITH_TBB=ON \
-DOpenGL_GL_PREFERENCE=GLVND \
-DBUILD_WITH_DEBUG_INFO=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_PERF_TESTS=OFF \
-DBUILD_EXAMPLES=ON \
-DINSTALL_C_EXAMPLES=ON \
-DINSTALL_PYTHON_EXAMPLES=ON \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCUDA_NVCC_FLAGS="--expt-relaxed-constexpr" \
-DOPENCV_SKIP_PYTHON_LOADER=ON \
-DOPENCV_EXTRA_MODULES_PATH="$srcdir"/opencv_contrib/modules \
-DLAPACK_LIBRARIES="/usr/lib/liblapack.so;/usr/lib/libblas.so;/usr/lib/libcblas.so" \
-DLAPACK_CBLAS_H="/usr/include/cblas.h" \
-DLAPACK_LAPACKE_H="/usr/include/lapacke.h" \
-DOPENCV_GENERATE_PKGCONFIG=ON \
-DOPENCV_ENABLE_NOFREE=ON \
-DOPENCV_JNI_INSTALL_PATH=lib \
-DOPENCV_GENERATE_SETUPVARS=OFF \
..

make -j $(expr $(nproc) - 2)

Issue 2:
OpenCV uses some ffmpeg APIs that have been removed in the just released ffmpeg 5.0 and makes some assumptions about ffmpeg structs that are no longer true (primarily trying to access the "codec" member in an AVStream).

This causes the build to fail.