首页 > 解决方案 > cmake配置不完整,conda环境下尝试安装opencv时出错

问题描述

我正在尝试使用 cmake 从源代码安装 opencv,因为正常安装不支持 gstreamer。我正在使用 conda 环境来执行此操作,但我已经设法在其上安装了大多数缺少的依赖项,但仍然出现一些错误和一长串错误日志。

我正在使用jetson nano ubuntu 18,我已经下载了opencv zip文件并构建了构建目录。在终端我使用这个 cmake 命令:

cmake -D CMAKE_BUILD_TYPE=RELEASE
-D INSTALL_PYTHON_EXAMPLES=ON
-D INSTALL_C_EXAMPLES=OFF
-D PYTHON_EXECUTABLE=$(which python3)
-D BUILD_opencv_python2=OFF
-D CMAKE_INSTALL_PREFIX=/home/ktbm/miniconda3/envs/THOR_test
-D PYTHON3_EXECUTABLE=$(which python3)
-DPYTHON3_INCLUDE_DIR=/home/ktbm/miniconda3/envs/THOR_test/include/python3.9
-DPYTHON3_PACKAGES_PATH=/home/ktbm/miniconda3/envs/THOR_test/lib/python3.9/site- 
 packages
-D WITH_GSTREAMER=ON
-D BUILD_EXAMPLES=ON
-D WITH_VTK=OFF
-D BUILD_opencv_viz=OFF
-D OPENCV_EXTRA_MODULES_PATH=home/ktbm/Downloads/opencv_contrib-master/modules ..

我得到这个:

-- Detected processor: aarch64
-- 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")
-- Found system OpenJPEG: openjp2 (found version "")
-- Found ZLIB: /usr/lib/aarch64-linux-gnu/libz.so (found version "1.2.11")
-- LAPACK(LAPACK/Generic): LAPACK_LIBRARIES: /home/ktbm/miniconda3/envs/THOR_test/lib/libopenblas.so;/home/ktbm/miniconda3/envs/THOR_test/lib/libopenblas.so
-- LAPACK(LAPACK/Generic): Support is enabled.
-- Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
-- Could NOT find Flake8 (missing: FLAKE8_EXECUTABLE)
CMake Error at cmake/OpenCVModule.cmake:274 (message):
No modules has been found:
/home/ktbm/Downloads/opencv/build/home/ktbm/Downloads/opencv_contrib-master/modules
Call Stack (most recent call first):
cmake/OpenCVModule.cmake:356 (_glob_locations)
cmake/OpenCVModule.cmake:385 (ocv_glob_modules)
CMakeLists.txt:917 (ocv_register_modules)

-- Checking for module 'libavresample'
-- No package 'libavresample' found
-- Allocator metrics storage type: 'int'
-- Excluding from source files list: /modules/core/test/test_intrin128.sse2.cpp
-- Excluding from source files list: /modules/core/test/test_intrin128.sse3.cpp
-- Excluding from source files list: /modules/core/test/test_intrin128.ssse3.cpp
-- Excluding from source files list: /modules/core/test/test_intrin128.sse4_1.cpp
-- Excluding from source files list: /modules/core/test/test_intrin128.sse4_2.cpp
-- Excluding from source files list: /modules/core/test/test_intrin128.avx.cpp
-- Excluding from source files list: /modules/core/test/test_intrin128.avx2.cpp
-- Excluding from source files list: /modules/core/test/test_intrin128.avx512_skx.cpp
-- Excluding from source files list: /modules/core/test/test_intrin256.avx2.cpp
-- Excluding from source files list: /modules/core/test/test_intrin256.avx512_skx.cpp
-- Excluding from source files list: /modules/core/test/test_intrin512.avx512_skx.cpp
-- Excluding from source files list: modules/imgproc/src/corner.avx.cpp
-- Excluding from source files list: modules/imgproc/src/imgwarp.avx2.cpp
-- Excluding from source files list: modules/imgproc/src/imgwarp.sse4_1.cpp
-- Excluding from source files list: modules/imgproc/src/resize.avx2.cpp
-- Excluding from source files list: modules/imgproc/src/resize.sse4_1.cpp
-- Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': /home/ktbm/Downloads/opencv/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
-- opencv_dnn: filter out cuda4dnn source code
-- Excluding from source files list: /modules/dnn/layers/layers_common.avx.cpp
-- Excluding from source files list: /modules/dnn/layers/layers_common.avx2.cpp
-- Excluding from source files list: /modules/dnn/layers/layers_common.avx512_skx.cpp
-- Excluding from source files list: /modules/dnn/layers/layers_common.rvv.cpp
-- Excluding from source files list: /modules/dnn/int8layers/layers_common.avx2.cpp
-- Excluding from source files list: /modules/dnn/int8layers/layers_common.avx512_skx.cpp
-- Excluding from source files list: modules/features2d/src/fast.avx2.cpp
-- highgui: using builtin backend: GTK3
-- Found 'misc' Python modules from /home/ktbm/Downloads/opencv/modules/python/package/extra_modules
-- Found 'mat_wrapper;utils' Python modules from /home/ktbm/Downloads/opencv/modules/core/misc/python/package
-- Found 'gapi' Python modules from /home/ktbm/Downloads/opencv/modules/gapi/misc/python/package
-- Found 'misc' Python modules from /home/ktbm/Downloads/opencv/modules/python/package/extra_modules
-- Found 'mat_wrapper;utils' Python modules from /home/ktbm/Downloads/opencv/modules/core/misc/python/package
-- Found 'gapi' Python modules from /home/ktbm/Downloads/opencv/modules/gapi/misc/python/package
-- OpenCL samples are skipped: OpenCL SDK is required
-- SYCL/OpenCL samples are skipped: SYCL SDK is required
-- - check configuration of SYCL_DIR/SYCL_ROOT/CMAKE_MODULE_PATH
-- - ensure that right compiler is selected from SYCL SDK (e.g, clang++): CMAKE_CXX_COMPILER=/usr/bin/c++
-- Registered 'check_pylint' target: using /home/ktbm/.local/bin/pylint (ver: 2.11.1), checks: 190
CMake Warning at cmake/OpenCVGenSetupVars.cmake:54 (message):
CONFIGURATION IS NOT SUPPORTED: validate setupvars script in install
directory
Call Stack (most recent call first):
CMakeLists.txt:1025 (include)

--
-- General configuration for OpenCV 4.5.4-dev =====================================
-- Version control: 4.5.4-58-g0a71063530
-- Platform:
-- Timestamp: 2021-10-26T16:05:14Z
-- Host: Linux 4.9.253-tegra aarch64
-- CMake: 3.10.2
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/make
-- Configuration: RELEASE
-- CPU/HW features:
-- Baseline: NEON FP16
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ standard: 11
-- C++ Compiler: /usr/bin/c++ (ver 7.5.0)
-- C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
-- C Compiler: /usr/bin/cc
-- C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release): -Wl,--gc-sections -Wl,--as-needed
-- Linker flags (Debug): -Wl,--gc-sections -Wl,--as-needed
-- ccache: NO
-- Precompiled headers: NO
-- Extra dependencies: dl m pthread rt
-- 3rdparty dependencies:
-- OpenCV modules:
-- To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo python3 stitching ts video videoio
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: java python2
-- Applications: tests perf_tests examples apps
-- Documentation: NO
-- Non-free algorithms: NO
-- GUI: GTK3
-- GTK+: YES (ver 3.22.30)
-- GThread : YES (ver 2.56.4)
-- GtkGlExt: NO
-- Media I/O:
-- ZLib: /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.11)
-- JPEG: /home/ktbm/miniconda3/envs/THOR_test/lib/libjpeg.so (ver 90)
-- WEBP: /home/ktbm/miniconda3/envs/THOR_test/lib/libwebp.so (ver encoder: 0x020f)
-- PNG: /home/ktbm/miniconda3/envs/THOR_test/lib/libpng.so (ver 1.6.37)
-- TIFF: /home/ktbm/miniconda3/envs/THOR_test/lib/libtiff.so (ver 42 / 4.3.0)
-- JPEG 2000: OpenJPEG (ver 2.4.0)
-- OpenEXR: build (ver 2.3.0)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
-- PFM: YES
-- Video I/O:
-- DC1394: YES (2.2.5)
-- FFMPEG: YES
-- avcodec: YES (57.107.100)
-- avformat: YES (57.83.100)
-- avutil: YES (55.78.100)
-- swscale: YES (4.8.100)
-- avresample: NO
-- GStreamer: YES (1.14.5)
-- v4l/v4l2: YES (linux/videodev2.h)
-- Parallel framework: pthreads
-- Trace: YES (with Intel ITT)
-- Other third-party libraries:
-- Lapack: YES (/home/ktbm/miniconda3/envs/THOR_test/lib/libopenblas.so /home/ktbm/miniconda3/envs/THOR_test/lib/libopenblas.so)
-- Eigen: YES (ver 3.3.4)
-- Custom HAL: YES (carotene (ver 0.0.1))
-- Protobuf: build (3.5.1)
-- OpenCL: YES (no extra features)
-- Include path: /home/ktbm/Downloads/opencv/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
-- Python 3:
-- Interpreter: /home/ktbm/miniconda3/envs/THOR_test/bin/python3 (ver 3.9.7)
-- Libraries: /home/ktbm/miniconda3/envs/THOR_test/lib/libpython3.9.so (ver 3.9.7)
-- numpy: /home/ktbm/miniconda3/envs/THOR_test/lib/python3.9/site-packages/numpy/core/include (ver 1.20.3)
-- install path: /home/ktbm/miniconda3/envs/THOR_test/lib/python3.9/site-packages/cv2/python-3.9
-- Python (for build): /home/ktbm/miniconda3/envs/THOR_test/bin/python3
-- Java:
-- ant: NO
-- JNI: NO
-- Java wrappers: NO
-- Java tests: NO
-- Install to: /home/ktbm/miniconda3/envs/THOR_test

--
-- Configuring incomplete, errors occurred!

该指南说要使用:

 -D CMAKE_INSTALL_PREFIX=$(python3 -c “import sys; print(sys.prefix)”)
 -D PYTHON3_INCLUDE_DIR=$(python3 -c “from distutils.sysconfig import get_python_inc; 
 print(get_python_inc())”)
 -D PYTHON3_PACKAGES_PATH=$(python3 -c “from distutils.sysconfig import 
 get_python_lib; print(get_python_lib())”) \

但这没有用,所以我更改为如上所示的直接路径,我似乎找不到任何修复它的方法。将不胜感激任何帮助

标签: pythonopencvcmake

解决方案


推荐阅读