Install error on Ubuntu and Debian for Orange Pi 5

I am not able to install OpenCV on Ubuntu and Debian for Orange Pi 5 Single Board Computer. The error I got are as follows. Can you help how can I solve this?

cmake ../opencv:

Python 2.7.18
-- Looking for ccache - not found
-- Found ZLIB: /usr/lib/aarch64-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.5.0, BUILD = opencv-4.8.0-dev-openjp2-2.5.0
-- OpenJPEG libraries will be built from sources: libopenjp2 (version "2.5.0")
-- Found ZLIB: /usr/lib/aarch64-linux-gnu/libz.so (found version "1.2.11") 
-- Found OpenEXR: /usr/lib/aarch64-linux-gnu/libIlmImf-2_5.so
-- 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 Java (missing: Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE Java_JAVADOC_EXECUTABLE) (found version "11.0.20.1")
-- Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) 
-- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
-- Checking for module 'gtk+-3.0'
--   No package 'gtk+-3.0' found
-- Checking for module 'libavresample'
--   No package 'libavresample' found
-- Allocator metrics storage type: 'int'

make -j4:

[ 34%] Building CXX object modules/features2d/CMakeFiles/opencv_features2d.dir/src/mser.cpp.o
[ 34%] Linking CXX shared library ../../lib/libopencv_imgcodecs.so
/usr/bin/ld: CMakeFiles/opencv_imgcodecs.dir/src/grfmt_png.cpp.o: in function `cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)':
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xb0): undefined reference to `png_set_longjmp_fn'
/usr/bin/ld: CMakeFiles/opencv_imgcodecs.dir/src/grfmt_png.cpp.o: in function `cv::PngDecoder::readData(cv::Mat&)':
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x100): undefined reference to `png_set_longjmp_fn'
/usr/bin/ld: grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x230): undefined reference to `png_get_eXIf_1'
/usr/bin/ld: grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x2d0): undefined reference to `png_get_eXIf_1'
/usr/bin/ld: CMakeFiles/opencv_imgcodecs.dir/src/grfmt_png.cpp.o: in function `cv::PngDecoder::readHeader()':
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0xd4): undefined reference to `png_set_longjmp_fn'
collect2: error: ld returned 1 exit status
make[2]: *** [modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/build.make:470: lib/libopencv_imgcodecs.so.4.8.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:2405: modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 34%] Building CXX object modules/features2d/CMakeFiles/opencv_features2d.dir/src/orb.cpp.o

your system’s png library did not meet certain expectations

try to use the 3rd party libpng, that comes with opencv src (probably a better fit)
and add

-DBUILD_PNG=ON

to your cmake flags, clean up radically & start all over.

Since I am not good at cmake, can you tell me which file should I change? Thanks in advance.

not a file, but the cmdline args, like

 cmake  -DBUILD_PNG=ON ../opencv