C++ 在Linux上为Aarch64(yocto)交叉编译OpenCV无法生成
我签出了opencv源代码,能够在linux上为x86_64构建,但未能在linux上为Aarch交叉编译 对于Linux,我使用了以下命令,效果很好:C++ 在Linux上为Aarch64(yocto)交叉编译OpenCV无法生成,c++,opencv,opencv4android,C++,Opencv,Opencv4android,我签出了opencv源代码,能够在linux上为x86_64构建,但未能在linux上为Aarch交叉编译 对于Linux,我使用了以下命令,效果很好: 5 #inside build folder 6 7 cmake -D CMAKE_BUILD_TYPE=RELEASE \ 8 -D CMAKE_INSTALL_PREFIX=/usr/local \ 9 -D OPENCV_EXTRA_MODULES_PATH=/usr/local/opencv_contrib/mod
5 #inside build folder
6
7 cmake -D CMAKE_BUILD_TYPE=RELEASE \
8 -D CMAKE_INSTALL_PREFIX=/usr/local \
9 -D OPENCV_EXTRA_MODULES_PATH=/usr/local/opencv_contrib/modules \
10 -D OpenBLAS_INCLUDE_DIR=/usr/include/x86_64-linux-gnu \
11 -D OpenBLAS_LIB=/usr/lib/x86_64-linux-gnu/libopenblas.so \
12 -D INSTALL_TESTS=ON \
13 -D INSTALL_C_EXAMPLES=ON \
14 -D WITH_PYTHON=ON \
15 -D INSTALL_PYTHON_EXAMPLES=ON ..
16
17
18 make -j4
类似地,我使用以下命令进行交叉编译:
6 #inside build folder
7
8 cmake -D CMAKE_BUILD_TYPE=RELEASE \
9 -D CMAKE_TOOLCHAIN_FILE=/usr/local/opencv/platforms/linux/aarch64-gnu.toolchain.cmake \
10 -D INSTALL_TESTS=ON \
11 -D INSTALL_C_EXAMPLES=ON \
12 -D WITH_PYTHON=ON \
13 -D SOFTFP=ON \
14 -D INSTALL_PYTHON_EXAMPLES=ON ..
15
16
17 make -j4
18
~
它在cmake命令下失败。上面写着“配置不完整,错误”
发生了!”
结果如下:
-- Detected processor: aarch64
-- Looking for ccache - not found
-- NEON is not supported by C++ compiler
-- FP16 is not supported by C++ compiler
-- Optimization NEON is not available, skipped
-- Optimization FP16 is not available, skipped
-- OpenCV disables pkg-config to avoid using of host libraries. Consider using PKG_CONFIG_LIBDIR to specify target SYSROOT
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) (Required is at least version "1.2.3")
-- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)
-- libjpeg-turbo: VERSION = 2.0.6, BUILD = opencv-4.5.1-dev-libjpeg-turbo
-- Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_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.3.1, BUILD = opencv-4.5.1-dev-openjp2-2.3.1
-- OpenJPEG libraries will be built from sources: libopenjp2 (version "2.3.1")
-- Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
-- 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)
-- LAPACK requires BLAS
-- A library with LAPACK API not found. Please specify library location.
-- Carotene: NEON is not available, disabling carotene...
-- OpenCV Python: during development append to PYTHONPATH: /usr/local/opencv/build/python_loader
-- Allocator metrics storage type: 'int'
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.sse2.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.sse3.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.ssse3.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.sse4_1.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.sse4_2.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.avx.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.fp16.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.avx2.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.avx512_skx.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin256.avx2.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin256.avx512_skx.cpp
-- Excluding from source files list: <BUILD>/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': /usr/local/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.avx.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx2.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx512_skx.cpp
-- Excluding from source files list: modules/features2d/src/fast.avx2.cpp
--
-- General configuration for OpenCV 4.5.1-dev =====================================
-- Version control: 4.5.1-64-gd34a34f328
--
-- Platform:
-- Timestamp: 2021-01-13T11:12:36Z
-- Host: Linux 5.4.0-58-generic x86_64
-- Target: Linux 1 aarch64
-- CMake: 3.16.3
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/make
-- Configuration: RELEASE
--
-- CPU/HW features:
-- Baseline:
-- requested: NEON FP16
-- required: NEON
-- disabled: VFPV3
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ standard: 11
-- C++ Compiler: /usr/bin/c++ (ver 9.3.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 stitching ts video videoio
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: java python2 python3
-- Applications: tests perf_tests apps
-- Documentation: NO
-- Non-free algorithms: NO
--
-- GUI:
-- GTK+: NO
--
-- Media I/O:
-- ZLib: zlib (ver 1.2.11)
-- JPEG: libjpeg-turbo (ver 2.0.6-62)
-- WEBP: build (ver encoder: 0x020f)
-- PNG: build (ver 1.6.37)
-- TIFF: build (ver 42 - 4.0.10)
-- JPEG 2000: build (ver 2.3.1)
-- 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:
-- Lapack: NO
-- Custom HAL: NO
-- Protobuf: build (3.5.1)
--
-- OpenCL: YES (no extra features)
-- Include path: /usr/local/opencv/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
--
-- Python (for build): /usr/bin/python2.7
--
-- Install to: /usr/local/opencv/build/install
-- -----------------------------------------------------------------
--
-- Configuring incomplete, errors occurred!
See also "/usr/local/opencv/build/CMakeFiles/CMakeOutput.log".
See also "/usr/local/opencv/build/CMakeFiles/CMakeError.log".
--检测到的处理器:aarch64
--正在查找ccache-未找到
NEN不受C++编译器的支持
FP16不支持C++编译器
--优化不可用,已跳过
--优化FP16不可用,已跳过
--OpenCV禁用pkg config以避免使用主机库。考虑使用PKGYObjuleLIbdir指定目标SysRoad
--找不到ZLIB(缺少:ZLIB_库ZLIB_INCLUDE_DIR)(至少需要版本“1.2.3”)
--找不到JPEG(缺少:JPEG\u库JPEG\u INCLUDE\u DIR)
--libjpeg-turbo:VERSION=2.0.6,BUILD=opencv-4.5.1-dev-libjpeg-turbo
--找不到TIFF(缺少:TIFF\u库TIFF\u INCLUDE\u目录)
--找不到OpenJPEG(最低适用版本:2.0,建议版本>=2.3.1)。OpenJPEG将从源代码构建
--OpenJPEG:VERSION=2.3.1,BUILD=opencv-4.5.1-dev-openjp2-2.3.1
--OpenJPEG库将从以下来源构建:libopenjp2(版本“2.3.1”)
--找不到PNG(缺少:PNG\u库PNG\u PNG\u INCLUDE\u DIR)
--找不到OpenBLAS include。关闭OpenBLAS_发现
--找不到OpenBLAS库。关闭OpenBLAS_发现
--找不到地图集(缺少:地图集\u CBLAS\u INCLUDE\u DIR地图集\u CLAPACK\u INCLUDE\u DIR地图集\u CBLAS\u库地图集\u BLAS\u库地图集\u LAPACK\u库)
--找不到BLAS(缺少:BLAS_库)
--拉帕克需要BLAS
--找不到具有LAPACK API的库。请指定库位置。
--胡萝卜素:霓虹灯不可用,禁用胡萝卜素。。。
--OpenCV-Python:在开发过程中附加到PYTHONPATH:/usr/local/OpenCV/build/Python\u-loader
--分配器度量存储类型:“int”
--从源文件列表中排除:/modules/core/test/test_intrin128.sse2.cpp
--从源文件列表中排除:/modules/core/test/test_intrin128.sse3.cpp
--从源文件列表中排除:/modules/core/test/test\u intrin128.ssse3.cpp
--从源文件列表中排除:/modules/core/test/test_intrin128.sse4_1.cpp
--从源文件列表中排除:/modules/core/test/test_intrin128.sse4_2.cpp
--从源文件列表中排除:/modules/core/test/test\u intrin128.avx.cpp
--从源文件列表中排除:/modules/core/test/test\u intrin128.fp16.cpp
--从源文件列表中排除:/modules/core/test/test_intrin128.avx2.cpp
--从源文件列表中排除:/modules/core/test/test\u intrin128.avx512\u skx.cpp
--从源文件列表中排除:/modules/core/test/test\u intrin256.avx2.cpp
--从源文件列表中排除:/modules/core/test/test\u intrin256.avx512\u skx.cpp
--从源文件列表中排除:/modules/core/test/test\u intrin512.avx512\u skx.cpp
--从源文件列表中排除:modules/imgproc/src/corner.avx.cpp
--从源文件列表中排除:modules/imgproc/src/imgwarp.avx2.cpp
--从源文件列表中排除:modules/imgproc/src/imgwarp.sse4_1.cpp
--从源文件列表中排除:modules/imgproc/src/resize.avx2.cpp
--从源文件列表中排除:modules/imgproc/src/resize.sse4_1.cpp
--注册hook'INIT_MODULE_SOURCES_opencv_dnn':/usr/local/opencv/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
--opencv_dnn:过滤掉cuda4dnn源代码
--从源文件列表中排除:/modules/dnn/layers/layers\u common.avx.cpp
--从源文件列表中排除:/modules/dnn/layers/layers\u common.avx2.cpp
--从源文件列表中排除:/modules/dnn/layers/layers\u common.avx512\u skx.cpp
--从源文件列表中排除:modules/feature2d/src/fast.avx2.cpp
--
--OpenCV 4.5.1-dev的一般配置=====================================
--版本控制:4.5.1-64-gd34a34f328
--
--站台:
--时间戳:2021-01-13T11:12:36Z
--主机:Linux 5.4.0-58-generic x86_64
--目标:Linux 1 aarch64
--CMake:3.16.3
--CMake生成器:Unix生成文件
--CMake构建工具:/usr/bin/make
--配置:发布
--
--CPU/HW功能:
--基线:
--请求:NEON FP16
--必需:霓虹灯
--禁用:VFPV3
--
--C/C++:
--构建为动态库?:是
——C++标准:11
C++编译器:/Ur/bin /C++(VER 93.0)
——C++标志(发布):-fsigned char-W-Wall-Werror=return type-Werror=non-virtual dtor-Werror=address-Werror=sequence point-Wformat-Werror=format security-Wmissing声明-Wundef-Winit self-Wpointer arith-Wshadow-Wsign promo-Wuninitialized-Wsuggest override-Wno删除非虚拟dtor-Wno注释-Wimplicit fallthrough=3-Wno严格溢出-fdiagnostics show option-pthread-fomit frame pointer-fffunction sections-fdata sections-fvisibility=hidden-fvisibility inlines hidden-O3-DNDEBUG-DNDEBUG
——C++标志(调试):-fsigned char-W-Wall-Werror=return type-Werror=non-virtual dtor-Werror=address-Werror=sequence point-Wformat-Werror=format security-Wmissing声明-Wundef-Winit self-Wpointer arith-Wshadow-Wsign promo-Wuninitialized-Wsuggest override-Wno删除非虚拟dtor-Wno注释-Wimplicit fallthrough=3-Wno严格溢出-fdiagnostics show option-pthread-fomit frame pointer-fffunction sections-fdata sections-fvisibility=hidden-fvisibility inlines hidden-g-O0-DDEBUG-D_DEBUG
--C编译器:/usr/bin/cc
--C标志(发布):-fsigned char-W-Wall-Werror=返回类型-We