Try to build OpenCV 4.5 in WSL2 but fail with openjpeg

When I try to set up the build by CMake, it actually recognized that the openjpeg lib has been installed in WSL2 ( ubuntu 22.04 ),:

-- Media I/O:

– ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
– JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
– WEBP: build (ver encoder: 0x020f)
– PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.37)
– TIFF: build (ver 42 - 4.2.0)
– JPEG 2000: OpenJPEG (ver 2.4.0)

but when I built it, this error occurred:

In file included from /home/samwu/opencv_build/opencv/modules/imgcodecs/src/grfmts.hpp:55,
                 from /home/samwu/opencv_build/opencv/modules/imgcodecs/src/loadsave.cpp:47:
/home/samwu/opencv_build/opencv/modules/imgcodecs/src/grfmt_jpeg2000_openjpeg.hpp:13:10: fatal error:
openjpeg.h: No such file or directory
   13 | #include <openjpeg.h>
      |          ^~~~~~~~~~~~
compilation terminated.
make[2]: *** [modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/build.make:76: modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/src/loadsave.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2402: modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

I tried to paste all the correspondent header file to /usr/include , and it did find them, but still:

/usr/bin/ld: CMakeFiles/opencv_imgcodecs.dir/src/loadsave.cpp.o: in function `std::_Sp_counted_ptr_inplace<cv::Jpeg2KJP2OpjDecoder, std::allocator<cv::Jpeg2KJP2OpjDecoder>, (__gnu_cxx::_Lock_policy)2>::_M_dispose()':
loadsave.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN2cv19Jpeg2KJP2OpjDecoderESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv[_ZNSt23_Sp_counted_ptr_inplaceIN2cv19Jpeg2KJP2OpjDecoderESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv]+0x24): undefined reference to `opj_image_destroy'
/usr/bin/ld: loadsave.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN2cv19Jpeg2KJP2OpjDecoderESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv[_ZNSt23_Sp_counted_ptr_inplaceIN2cv19Jpeg2KJP2OpjDecoderESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv]+0x35): undefined reference to `opj_destroy_codec'
/usr/bin/ld: loadsave.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN2cv19Jpeg2KJP2OpjDecoderESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv[_ZNSt23_Sp_counted_ptr_inplaceIN2cv19Jpeg2KJP2OpjDecoderESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv]+0x46): undefined reference to `opj_stream_destroy'
/usr/bin/ld: CMakeFiles/opencv_imgcodecs.dir/src/loadsave.cpp.o: in function `std::_Sp_counted_ptr_inplace<cv::Jpeg2KJ2KOpjDecoder, std::allocator<cv::Jpeg2KJ2KOpjDecoder>, (__gnu_cxx::_Lock_policy)2>::_M_dispose()':
loadsave.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN2cv19Jpeg2KJ2KOpjDecoderESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv[_ZNSt23_Sp_counted_ptr_inplaceIN2cv19Jpeg2KJ2KOpjDecoderESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv]+0x24): undefined reference to `opj_image_destroy'
/usr/bin/ld: loadsave.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN2cv19Jpeg2KJ2KOpjDecoderESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv[_ZNSt23_Sp_counted_ptr_inplaceIN2cv19Jpeg2KJ2KOpjDecoderESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv]+0x35): undefined reference to `opj_destroy_codec'
/usr/bin/ld: loadsave.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN2cv19Jpeg2KJ2KOpjDecoderESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv[_ZNSt23_Sp_counted_ptr_inplaceIN2cv19Jpeg2KJ2KOpjDecoderESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv]+0x46): undefined reference to `opj_stream_destroy'
/usr/bin/ld: CMakeFiles/opencv_imgcodecs.dir/src/grfmt_jpeg2000_openjpeg.cpp.o: in function `cv::detail::Jpeg2KOpjDecoderBase::~Jpeg2KOpjDecoderBase()':
grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBaseD2Ev[_ZN2cv6detail20Jpeg2KOpjDecoderBaseD5Ev]+0x1f): undefined reference to `opj_image_destroy'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBaseD2Ev[_ZN2cv6detail20Jpeg2KOpjDecoderBaseD5Ev]+0x30): undefined reference to `opj_destroy_codec'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBaseD2Ev[_ZN2cv6detail20Jpeg2KOpjDecoderBaseD5Ev]+0x41): undefined reference to `opj_stream_destroy'
/usr/bin/ld: CMakeFiles/opencv_imgcodecs.dir/src/grfmt_jpeg2000_openjpeg.cpp.o: in function `cv::Jpeg2KJ2KOpjDecoder::~Jpeg2KJ2KOpjDecoder()':
grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv19Jpeg2KJ2KOpjDecoderD2Ev[_ZN2cv19Jpeg2KJ2KOpjDecoderD5Ev]+0x1f): undefined reference to `opj_image_destroy'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv19Jpeg2KJ2KOpjDecoderD2Ev[_ZN2cv19Jpeg2KJ2KOpjDecoderD5Ev]+0x30): undefined reference to `opj_destroy_codec'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv19Jpeg2KJ2KOpjDecoderD2Ev[_ZN2cv19Jpeg2KJ2KOpjDecoderD5Ev]+0x41): undefined reference to `opj_stream_destroy'
/usr/bin/ld: CMakeFiles/opencv_imgcodecs.dir/src/grfmt_jpeg2000_openjpeg.cpp.o: in function `cv::Jpeg2KJP2OpjDecoder::~Jpeg2KJP2OpjDecoder()':
grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv19Jpeg2KJP2OpjDecoderD2Ev[_ZN2cv19Jpeg2KJP2OpjDecoderD5Ev]+0x1f): undefined reference to `opj_image_destroy'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv19Jpeg2KJP2OpjDecoderD2Ev[_ZN2cv19Jpeg2KJP2OpjDecoderD5Ev]+0x30): undefined reference to `opj_destroy_codec'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv19Jpeg2KJP2OpjDecoderD2Ev[_ZN2cv19Jpeg2KJP2OpjDecoderD5Ev]+0x41): undefined reference to `opj_stream_destroy'
/usr/bin/ld: CMakeFiles/opencv_imgcodecs.dir/src/grfmt_jpeg2000_openjpeg.cpp.o: in function `cv::detail::Jpeg2KOpjDecoderBase::~Jpeg2KOpjDecoderBase()':
grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBaseD0Ev[_ZN2cv6detail20Jpeg2KOpjDecoderBaseD5Ev]+0x1f): undefined reference to `opj_image_destroy'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBaseD0Ev[_ZN2cv6detail20Jpeg2KOpjDecoderBaseD5Ev]+0x30): undefined reference to `opj_destroy_codec'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBaseD0Ev[_ZN2cv6detail20Jpeg2KOpjDecoderBaseD5Ev]+0x41): undefined reference to `opj_stream_destroy'
/usr/bin/ld: CMakeFiles/opencv_imgcodecs.dir/src/grfmt_jpeg2000_openjpeg.cpp.o: in function `cv::Jpeg2KJP2OpjDecoder::~Jpeg2KJP2OpjDecoder()':
grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv19Jpeg2KJP2OpjDecoderD0Ev[_ZN2cv19Jpeg2KJP2OpjDecoderD5Ev]+0x1f): undefined reference to `opj_image_destroy'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv19Jpeg2KJP2OpjDecoderD0Ev[_ZN2cv19Jpeg2KJP2OpjDecoderD5Ev]+0x30): undefined reference to `opj_destroy_codec'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv19Jpeg2KJP2OpjDecoderD0Ev[_ZN2cv19Jpeg2KJP2OpjDecoderD5Ev]+0x41): undefined reference to `opj_stream_destroy'
/usr/bin/ld: CMakeFiles/opencv_imgcodecs.dir/src/grfmt_jpeg2000_openjpeg.cpp.o: in function `cv::Jpeg2KJ2KOpjDecoder::~Jpeg2KJ2KOpjDecoder()':
grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv19Jpeg2KJ2KOpjDecoderD0Ev[_ZN2cv19Jpeg2KJ2KOpjDecoderD5Ev]+0x1f): undefined reference to `opj_image_destroy'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv19Jpeg2KJ2KOpjDecoderD0Ev[_ZN2cv19Jpeg2KJ2KOpjDecoderD5Ev]+0x30): undefined reference to `opj_destroy_codec'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv19Jpeg2KJ2KOpjDecoderD0Ev[_ZN2cv19Jpeg2KJ2KOpjDecoderD5Ev]+0x41): undefined reference to `opj_stream_destroy'
/usr/bin/ld: CMakeFiles/opencv_imgcodecs.dir/src/grfmt_jpeg2000_openjpeg.cpp.o: in function `cv::(anonymous namespace)::setupLogCallbacks(void**)':
grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv12_GLOBAL__N_117setupLogCallbacksEPPv+0x78): undefined reference to `opj_set_error_handler'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv12_GLOBAL__N_117setupLogCallbacksEPPv+0x3e2): undefined reference to `opj_set_warning_handler'
/usr/bin/ld: CMakeFiles/opencv_imgcodecs.dir/src/grfmt_jpeg2000_openjpeg.cpp.o: in function `cv::detail::Jpeg2KOpjDecoderBase::readHeader() [clone .cold]':
grfmt_jpeg2000_openjpeg.cpp:(.text.unlikely._ZN2cv6detail20Jpeg2KOpjDecoderBase10readHeaderEv+0x4): undefined reference to `opj_stream_destroy'
/usr/bin/ld: CMakeFiles/opencv_imgcodecs.dir/src/grfmt_jpeg2000_openjpeg.cpp.o: in function `cv::detail::Jpeg2KOpjDecoderBase::readHeader()':
grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBase10readHeaderEv+0x92): undefined reference to `opj_stream_default_create'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBase10readHeaderEv+0xa7): undefined reference to `opj_stream_set_user_data'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBase10readHeaderEv+0xb6): undefined reference to `opj_stream_set_user_data_length'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBase10readHeaderEv+0xc5): undefined reference to `opj_stream_set_read_function'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBase10readHeaderEv+0xd4): undefined reference to `opj_stream_set_skip_function'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBase10readHeaderEv+0xe3): undefined reference to `opj_stream_set_seek_function'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBase10readHeaderEv+0xfb): undefined reference to `opj_stream_destroy'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBase10readHeaderEv+0x116): undefined reference to `opj_create_decompress'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBase10readHeaderEv+0x134): undefined reference to `opj_destroy_codec'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBase10readHeaderEv+0x156): undefined reference to `opj_set_default_decoder_parameters'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBase10readHeaderEv+0x165): undefined reference to `opj_setup_decoder'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBase10readHeaderEv+0x188): undefined reference to `opj_read_header'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBase10readHeaderEv+0x1ad): undefined reference to `opj_image_destroy'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBase10readHeaderEv+0x2a2): undefined reference to `opj_stream_create_default_file_stream'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBase10readHeaderEv+0x2c1): undefined reference to `opj_stream_destroy'
/usr/bin/ld: CMakeFiles/opencv_imgcodecs.dir/src/grfmt_jpeg2000_openjpeg.cpp.o: in function `cv::detail::Jpeg2KOpjDecoderBase::readData(cv::Mat&)':
grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv6detail20Jpeg2KOpjDecoderBase8readDataERNS_3MatE+0x8b): undefined reference to `opj_decode'
/usr/bin/ld: CMakeFiles/opencv_imgcodecs.dir/src/grfmt_jpeg2000_openjpeg.cpp.o: in function `cv::Jpeg2KOpjEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&) [clone .cold]':
grfmt_jpeg2000_openjpeg.cpp:(.text.unlikely._ZN2cv16Jpeg2KOpjEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x51): undefined reference to `opj_stream_destroy'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text.unlikely._ZN2cv16Jpeg2KOpjEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x59): undefined reference to `opj_destroy_codec'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text.unlikely._ZN2cv16Jpeg2KOpjEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x73): undefined reference to `opj_image_destroy'
/usr/bin/ld: CMakeFiles/opencv_imgcodecs.dir/src/grfmt_jpeg2000_openjpeg.cpp.o: in function `cv::Jpeg2KOpjEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)':
grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv16Jpeg2KOpjEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x114): undefined reference to `opj_set_default_encoder_parameters'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv16Jpeg2KOpjEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x66e): undefined reference to `opj_image_create'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv16Jpeg2KOpjEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x8a2): undefined reference to `opj_create_compress'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv16Jpeg2KOpjEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x8c9): undefined reference to `opj_setup_encoder'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv16Jpeg2KOpjEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x8e4): undefined reference to `opj_stream_create_default_file_stream'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv16Jpeg2KOpjEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x8fe): undefined reference to `opj_start_compress'/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv16Jpeg2KOpjEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x911): undefined reference to `opj_encode'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv16Jpeg2KOpjEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x924): undefined reference to `opj_end_compress'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv16Jpeg2KOpjEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x934): undefined reference to `opj_stream_destroy'/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv16Jpeg2KOpjEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x93c): undefined reference to `opj_destroy_codec'
/usr/bin/ld: grfmt_jpeg2000_openjpeg.cpp:(.text._ZN2cv16Jpeg2KOpjEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x956): undefined reference to `opj_image_destroy'
/usr/bin/ld: ../../lib/libopencv_imgcodecs.so.4.7.0: unable to sort relocs - they are of an unknown size
collect2: error: ld returned 1 exit status
make[2]: *** [modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/build.make:445: lib/libopencv_imgcodecs.so.4.7.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:2402: modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

(ps: the openjpeg lib has been installed, and all the files the build needs are stored in /usr/include/openjpeg-2.4)

So, how can I fix this?

May be you should update to 4.7. and try cmake -DBUILD_OPENJPEG:BOOL=ON

-- Detected processor: x86_64
-- Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version "2.7")
-- Looking for ccache - not found
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3")
Cleaning INTERNAL cached variable: WEBP_LIBRARY
Cleaning INTERNAL cached variable: WEBP_INCLUDE_DIR
-- Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1). OpenJPEG will be built from sources
-- OpenJPEG: VERSION = 2.4.0, BUILD = opencv-4.7.0-dev-openjp2-2.4.0
-- OpenJPEG libraries will be built from sources: libopenjp2 (version "2.4.0")
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
-- libva: missing va.h header (VA_INCLUDE_DIR)
-- found Intel IPP (ICV version): 2021.8.0 [2021.8]
-- at: /tmp/build/opencv/3rdparty/ippicv/ippicv_lnx/icv
-- found Intel IPP Integration Wrappers sources: 2021.8.0
-- at: /tmp/build/opencv/3rdparty/ippicv/ippicv_lnx/iw
-- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
-- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
-- Could NOT find Atlas (missing: Atlas_CBLAS_INCLUDE_DIR Atlas_CLAPACK_INCLUDE_DIR Atlas_CBLAS_LIBRARY Atlas_BLAS_LIBRARY Atlas_LAPACK_LIBRARY)
-- Could NOT find BLAS (missing: BLAS_LIBRARIES)
-- Could NOT find LAPACK (missing: LAPACK_LIBRARIES)
    Reason given by package: LAPACK could not be found because dependency BLAS could not be found.

-- Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
-- Found VTK 9.2.20230417
-- Checking for module 'gtk+-2.0'
--   No package 'gtk+-2.0' found
-- Checking for modules 'libavcodec;libavformat;libavutil;libswscale'
--   No package 'libavcodec' found
--   No package 'libavformat' found
--   No package 'libavutil' found
--   No package 'libswscale' found
-- FFMPEG is disabled. Required libraries: libavcodec;libavformat;libavutil;libswscale. Missing libraries: libavcodec;libavformat;libavutil;libswscale
-- Checking for module 'gstreamer-base-1.0'
--   No package 'gstreamer-base-1.0' found
-- Checking for module 'gstreamer-app-1.0'
--   No package 'gstreamer-app-1.0' found
-- Checking for module 'gstreamer-riff-1.0'
--   No package 'gstreamer-riff-1.0' found
-- Checking for module 'gstreamer-pbutils-1.0'
--   No package 'gstreamer-pbutils-1.0' found
-- Checking for module 'gstreamer-video-1.0'
--   No package 'gstreamer-video-1.0' found
-- Checking for module 'gstreamer-audio-1.0'
--   No package 'gstreamer-audio-1.0' found
-- Checking for module 'libdc1394-2'
--   No package 'libdc1394-2' found
-- Module opencv_alphamat disabled because the following dependencies are not found: Eigen
-- freetype2:   YES (ver 24.1.18)
-- harfbuzz:    YES (ver 2.7.4)
-- Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS) (found version "")
-- Julia not found. Not compiling Julia Bindings.
-- Module opencv_ovis disabled because OGRE3D was not found
-- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
-- Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
-- Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
-- Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
-- Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
-- Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
-- Checking for module 'tesseract'
--   No package 'tesseract' found
-- Tesseract:   NO
-- Allocator metrics storage type: 'long long'
-- Excluding from source files list: modules/imgproc/src/imgwarp.lasx.cpp
-- Excluding from source files list: modules/imgproc/src/resize.lasx.cpp
-- Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': /tmp/lib/opencv/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
-- opencv_dnn: filter out cuda4dnn source code
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.rvv.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.lasx.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/int8layers/layers_common.lasx.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/cpu_kernels/conv_depthwise.rvv.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/cpu_kernels/conv_depthwise.lasx.cpp
-- imgcodecs: OpenEXR codec is disabled in runtime. Details: https://github.com/opencv/opencv/issues/21326
-- highgui: using builtin backend: GTK3
-- rgbd: Eigen support is disabled. Eigen is Required for Posegraph optimization
--
-- General configuration for OpenCV 4.7.0-dev =====================================
--   Version control:               4.7.0-329-g4a559bc2ab
--
--   Extra modules:
--     Location (extra):            /tmp/lib/opencv_contrib/modules
--     Version control (extra):     4.7.0-52-gdeb22555
--
--   Platform:
--     Timestamp:                   2023-04-17T06:50:18Z
--     Host:                        Linux 5.15.90.1-microsoft-standard-WSL2 x86_64
--     CMake:                       3.22.1
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/gmake
--     Configuration:               Release
--
--   CPU/HW features:
--     Baseline:                    SSE SSE2 SSE3
--       requested:                 SSE3
--     Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
--       requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
--       SSE4_1 (16 files):         + SSSE3 SSE4_1
--       SSE4_2 (1 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
--       FP16 (0 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
--       AVX (7 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
--       AVX2 (34 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
--       AVX512_SKX (5 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
--
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ standard:                11
--     C++ Compiler:                /usr/bin/c++  (ver 11.3.0)
--     C++ flags (Release):         -fsigned-char -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 -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -fsigned-char -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 -g  -O0 -DDEBUG -D_DEBUG
--     C Compiler:                  /usr/bin/cc
--     C flags (Release):           -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -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 -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -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 -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):      -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a   -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
--     Linker flags (Debug):        -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a   -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
--     ccache:                      NO
--     Precompiled headers:         NO
--     Extra dependencies:          dl m pthread rt
--     3rdparty dependencies:
--
--   OpenCV modules:
--     To be built:                 aruco barcode bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab viz wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
--     Disabled:                    python_bindings_generator world
--     Disabled by dependency:      -
--     Unavailable:                 alphamat cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv hdf java julia matlab ovis python2 python3 sfm ts
--     Applications:                apps
--     Documentation:               NO
--     Non-free algorithms:         NO
--
--   GUI:                           GTK3
--     GTK+:                        YES (ver 3.24.33)
--       GThread :                  YES (ver 2.72.4)
--       GtkGlExt:                  NO
--     VTK support:                 YES (ver 9.2.20230417)
--
--   Media I/O:
--     ZLib:                        /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
--     JPEG:                        /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
--     WEBP:                        build (ver encoder: 0x020f)
--     PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.37)
--     TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.3.0)
--     JPEG 2000:                   build (ver 2.4.0)
--     OpenEXR:                     build (ver 2.3.0)
--     HDR:                         YES
--     SUNRASTER:                   YES
--     PXM:                         YES
--     PFM:                         YES
--
--   Video I/O:
--     DC1394:                      NO
--     FFMPEG:                      NO
--       avcodec:                   NO
--       avformat:                  NO
--       avutil:                    NO
--       swscale:                   NO
--       avresample:                NO
--     GStreamer:                   NO
--     v4l/v4l2:                    YES (linux/videodev2.h)
--
--   Parallel framework:            pthreads
--
--   Trace:                         YES (with Intel ITT)
--
--   Other third-party libraries:
--     Intel IPP:                   2021.8 [2021.8.0]
--            at:                   /tmp/build/opencv/3rdparty/ippicv/ippicv_lnx/icv
--     Intel IPP IW:                sources (2021.8.0)
--               at:                /tmp/build/opencv/3rdparty/ippicv/ippicv_lnx/iw
--     VA:                          NO
--     Lapack:                      NO
--     Eigen:                       NO
--     Custom HAL:                  NO
--     Protobuf:                    build (3.19.1)
--     Flatbuffers:                 builtin/3rdparty (23.5.9)
--
--   OpenCL:                        YES (no extra features)
--     Include path:                /tmp/lib/opencv/3rdparty/include/opencl/1.2
--     Link libraries:              Dynamic load
--
--   Python (for build):            /usr/bin/python3
--
--   Java:
--     ant:                         NO
--     JNI:                         NO
--     Java wrappers:               NO
--     Java tests:                  NO
--
--   Install to:                    /tmp/install/opencv
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done