在 Linux 主机上针对 Android 目标交叉编译 OpenCV:Cmake 配置期间出现错误

发布于 2025-01-15 10:35:16 字数 16139 浏览 0 评论 0原文

问题描述:

我正在尝试在 Ubuntu 20.04 LTS for Android (aarch64) 上编译具有 OpenCL 支持的 OpenCV 4.5.1(因为库存 OpenCV Android SDK 没有激活 OpenCL 支持)。我很大程度上遵循了本教程涵盖了 OpenCV 的交叉编译。

当尝试配置构建时,Cmake 似乎无法正确创建/定位所有必要的文件夹,从而引发错误(请参阅下面的 cmake 输出)。

我怀疑这可能与 Cmake 难以正确识别 ant 安装有关(如 Cmake 输出中 ant 路径后面缺少的版本号所示)。

我已经通过 Cmake 构建标志设置了 ANT 可执行文件以及 Java 主文件夹的环境变量(请参阅下面的 Cmake 命令)。

查看 Cmake 输出底部的错误消息时,很明显创建必要的 Android 和/或 Java 文件夹存在一些问题。在检查modules/java/android_sdk/CMakeLists.txt(参见下面的摘录)后,我注意到变量OPENCV_JAVA_DIR可能应该在cmake配置的早期阶段设置。但是,当运行下面粘贴的命令时,此变量保持为空,因此 cmake 无法访问文件夹,因为路径不正确。

这些是运行我的 cmake 配置命令时变量的值:

-- OPENCV_JAVA_DIR = /opencv
-- ANDROID_EXECUTABLE = FALSE
-- ANDROID_BUILD_BASE_DIR = 
-- OpenCV_BINARY_DIR= /home/flavio/Downloads/opencv/build_manual

我的 Cmake buildflags 中是否存在一些配置错误或我做错的完全不同的内容?

谢谢你的帮助!

相关问题

Cmake找不到ant

Cmake无法识别Java

Ant for Java 未显示为已安装,尽管已安装

我已尝试了所有建议的更改,但到目前为止没有成功。重新安装 ant 没有帮助,也没有在 /usr/bin 中的 /usr/share/ant/bin/ant 处创建指向可执行存储的符号链接。

使用的 Cmake 命令(在下载的 opencv 源代码内的 build 文件夹中):

cmake \
-DCMAKE_TOOLCHAIN_FILE=~/Android/Sdk/ndk/21.0.6113669/build/cmake/android.toolchain.cmake \
-DANDROID_TOOLCHAIN=clang++ \
-DANDROID_ABI=arm64-v8a \
-DANDROID_TARGET_SDK_VERSION=26 \
-DANDROID_MIN_SDK_VERSION=24 \
-DBUILD_JAVA=ON -DBUILD_FAT_JAVA_LIB=ON DBUILD_ZLIB=ON \
-D CMAKE_BUILD_TYPE=Release \
-D ANDROID_NATIVE_API_LEVEL=24 \
-DANDROID_COMPILE_SDK_VERSION=26 \
-D ANDROID_STL=c++_shared \
-D WITH_CUDA=OFF \
-D WITH_MATLAB=OFF \
-D BUILD_ANDROID_EXAMPLES=OFF -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=ON -D BUILD_SHARED_LIBS=OFF -DBUILD_ANDROID_PROJECTS=OFF -DBUILD_JNI=ON \
-DWITH_OPENCL=ON -DWITH_OPENGL=ON \
-DANT_HOME=/usr/share/ant -DJAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 -DANT_EXECUTABLE=/bin/ant \
-DSTRIP=/home/flavio/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip \
..

modules/java/android_sdk/CMakeList.txt 中提取

project(${the_module}_android)

if(ANDROID_EXECUTABLE)
  set(OPENCV_JAVA_DIR "${OpenCV_BINARY_DIR}/android_sdk" CACHE INTERNAL "")
else()  # gradle
  set(OPENCV_JAVA_DIR "${ANDROID_BUILD_BASE_DIR}/opencv" CACHE INTERNAL "")
endif()
set(OPENCV_ANDROID_LIB_DIR "${OPENCV_JAVA_DIR}" CACHE INTERNAL "")  # for OpenCV samples

message (STATUS "OPENCV_JAVA_DIR = ${OPENCV_JAVA_DIR}")
message (STATUS "ANDROID_BUILD_BASE_DIR = ${ANDROID_BUILD_BASE_DIR}")
message (STATUS "OpenCV_BINARY_DIR= ${OpenCV_BINARY_DIR}")
file(REMOVE_RECURSE "${OPENCV_JAVA_DIR}")
file(MAKE_DIRECTORY "${OPENCV_JAVA_DIR}/bin")
set(java_src_dir "${OPENCV_JAVA_DIR}/src")
file(MAKE_DIRECTORY "${java_src_dir}")

Cmake终端输出

-- Check for working CXX compiler: /home/flavio/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
-- Check for working CXX compiler: /home/flavio/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /home/flavio/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
-- Check for working C compiler: /home/flavio/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Detected processor: aarch64
CMake Warning at cmake/OpenCVUtils.cmake:752 (message):
  Unexpected option: WITH_OPENGL (=ON)

  Condition: IF (NOT;ANDROID;AND;NOT;WINRT)
Call Stack (most recent call first):
  CMakeLists.txt:308 (OCV_OPTION)


-- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.18", minimum required is "2.7") 
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3.2") 
-- Looking for ccache - not found
<---------- Performed Tests have been cut out from this output to meet character-limit of stackoverflow questions ----------->
-- ANDROID: TRUE
-- Update variable ANDROID_SDK_ROOT from environment: /home/flavio/Android/Sdk
-- Update variable ANDROID_HOME from environment: /home/flavio/Android/Sdk
Android: Projects builds are DISABLED
-- Looking for dlerror in dl
-- Looking for dlerror in dl - found
-- ADE: Download: v0.1.1f.zip
-- 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.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': /home/flavio/Downloads/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
-- OPENCV_JAVA_DIR = /opencv
-- ANDROID_BUILD_BASE_DIR = 
-- OpenCV_BINARY_DIR= /home/flavio/Downloads/opencv/build_manual
CMake Error at modules/java/android_sdk/CMakeLists.txt:15 (file):
  file problem creating directory: /opencv/bin


CMake Error at modules/java/android_sdk/CMakeLists.txt:17 (file):
  file problem creating directory: /opencv/src


CMake Error: Could not open file for write in copy operation /opencv/AndroidManifest.xml.tmp
CMake Error: : System Error: No such file or directory
CMake Error at modules/java/android_sdk/CMakeLists.txt:121 (configure_file):
  configure_file Problem configuring file


CMake Error: Could not open file for write in copy operation /opencv/build.gradle.tmp
CMake Error: : System Error: No such file or directory
CMake Error at modules/java/android_sdk/CMakeLists.txt:121 (configure_file):
  configure_file Problem configuring file


CMake Error: Could not open file for write in copy operation /opencv/res/values/attrs.xml.tmp
CMake Error: : System Error: No such file or directory
CMake Error at modules/java/android_sdk/CMakeLists.txt:121 (configure_file):
  configure_file Problem configuring file


CMake Error: Could not open file for write in copy operation /opencv/libcxx_helper/CMakeLists.txt.tmp
CMake Error: : System Error: No such file or directory
CMake Error at modules/java/android_sdk/CMakeLists.txt:133 (configure_file):
  configure_file Problem configuring file


CMake Error: Could not open file for write in copy operation /opencv/libcxx_helper/dummy.cpp.tmp
CMake Error: : System Error: No such file or directory
CMake Error at modules/java/android_sdk/CMakeLists.txt:133 (configure_file):
  configure_file Problem configuring file


CMake Error: Could not open file for write in copy operation /opencv/build.gradle.tmp
CMake Error: : System Error: No such file or directory
CMake Error at modules/java/android_sdk/CMakeLists.txt:160 (configure_file):
  configure_file Problem configuring file


-- Android OpenCV Manager is ignored
-- 
-- General configuration for OpenCV 4.5.1 =====================================
--   Version control:               unknown
-- 
--   Platform:
--     Timestamp:                   2022-03-20T09:57:50Z
--     Host:                        Linux 5.13.0-35-generic x86_64
--     Target:                      Android 1 aarch64
--     CMake:                       3.16.3
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               Release
-- 
--   CPU/HW features:
--     Baseline:                    NEON FP16
-- 
--   C/C++:
--     Built as dynamic libs?:      NO
--     C++ standard:                11
--     C++ Compiler:                /home/flavio/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++  (ver 9.0)
--     C++ flags (Release):         -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security     -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Qunused-arguments    -fvisibility=hidden -fvisibility-inlines-hidden -O2 -DNDEBUG   -DNDEBUG
--     C++ flags (Debug):           -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security     -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Qunused-arguments    -fvisibility=hidden -fvisibility-inlines-hidden -O0   -DDEBUG -D_DEBUG
--     C Compiler:                  /home/flavio/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
--     C flags (Release):           -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Qunused-arguments    -fvisibility=hidden -fvisibility-inlines-hidden -O2 -DNDEBUG   -DNDEBUG
--     C flags (Debug):             -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Qunused-arguments    -fvisibility=hidden -fvisibility-inlines-hidden -O0   -DDEBUG -D_DEBUG
--     Linker flags (Release):      -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments   -Wl,--as-needed  
--     Linker flags (Debug):        -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments   -Wl,--as-needed  
--     ccache:                      NO
--     Precompiled headers:         NO
--     Extra dependencies:          ade dl m log
--     3rdparty dependencies:       libcpufeatures ittnotify libprotobuf zlib libjpeg-turbo libwebp libpng libtiff libopenjp2 IlmImf quirc tegra_hal
-- 
--   OpenCV modules:
--     To be built:                 calib3d core dnn features2d flann gapi highgui imgcodecs imgproc java ml objdetect photo stitching ts video videoio
--     Disabled:                    world
--     Disabled by dependency:      -
--     Unavailable:                 python2 python3
--     Applications:                tests
--     Documentation:               NO
--     Non-free algorithms:         NO
-- 
--   Android NDK:                   /home/flavio/Android/Sdk/ndk/21.0.6113669 (ver 21.0.6113669)
--     Android ABI:                 arm64-v8a
--     NDK toolchain:               aarch64-linux-android-4.9
--     STL type:                    c++_shared
--     Native API level:            24
--   Android SDK:                   not used, projects are not built
-- 
--   GUI: 
--     OpenGL support:              NO
-- 
--   Media I/O: 
--     ZLib:                        build (ver 1.2.11)
--     JPEG:                        build-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)
--     OpenEXR:                     build (ver 2.3.0)
--     HDR:                         YES
--     SUNRASTER:                   YES
--     PXM:                         YES
--     PFM:                         YES
-- 
--   Video I/O:
-- 
--   Parallel framework:            pthreads
-- 
--   Trace:                         YES (with Intel ITT)
-- 
--   Other third-party libraries:
--     Custom HAL:                  YES (carotene (ver 0.0.1))
--     Protobuf:                    build (3.5.1)
-- 
--   OpenCL:                        YES (no extra features)
--     Include path:                /home/flavio/Downloads/opencv/3rdparty/include/opencl/1.2
--     Link libraries:              Dynamic load
-- 
--   Python (for build):            /usr/bin/python2.7
-- 
--   Java:                          export all functions
--     ant:                         /bin/ant (ver )
--     Java wrappers:               YES
--     Java tests:                  NO
-- 
--   Install to:                    /home/flavio/Downloads/opencv/build_manual/install
-- -----------------------------------------------------------------
-- 
-- Configuring incomplete, errors occurred!
See also "/home/flavio/Downloads/opencv/build_manual/CMakeFiles/CMakeOutput.log".
See also "/home/flavio/Downloads/opencv/build_manual/CMakeFiles/CMakeError.log".

Problem Description:

I am trying to compile OpenCV 4.5.1 on Ubuntu 20.04 LTS for Android (aarch64) with OpenCL support (since the stock OpenCV Android SDK does not have OpenCL support activated). I largely followed this tutorial covering the cross-compilation of OpenCV.

When trying to configure the build, Cmake seems to be unable to correctly create/locate all the necessary folders and thus throws an error (see cmake output below).

I suspect that it might have something to do with Cmake struggling to recognise the ant installation correctly (as indicated by the missing version number following the ant path in the Cmake output).

I have set the environment variables for the ANT executable as well as the Java Home folder through the Cmake build flags (see Cmake command below).

When looking at the error messages at the bottom of the Cmake output, it becomes clear that there is some problem with creating the necessary Android and/or Java folders. Upon inspection of modules/java/android_sdk/CMakeLists.txt (see extract below) I noticed that the variable OPENCV_JAVA_DIR should probably be set at some earlier stage in the cmake configuration. However, when running my command pasted below, this variable remains empty and hence cmake cannot access the folders since the path is not correct.

These are the values of the variables when running my cmake configuration command:

-- OPENCV_JAVA_DIR = /opencv
-- ANDROID_EXECUTABLE = FALSE
-- ANDROID_BUILD_BASE_DIR = 
-- OpenCV_BINARY_DIR= /home/flavio/Downloads/opencv/build_manual

Is there some configuration error in my Cmake buildflags or something entirely different that I am doing wrong?

Thanks for you help!

Related Questions

Cmake cannot find ant

Cmake cannot recognise Java

Ant for Java not showing as installed eventhough it is

I have tried all the proposed changes, so far with no success. Reinstallation of ant did not help, neither creating a symlink to the executable store at /usr/share/ant/bin/ant in /usr/bin.

Cmake Command used (in build folder inside the downloaded opencv-source):

cmake \
-DCMAKE_TOOLCHAIN_FILE=~/Android/Sdk/ndk/21.0.6113669/build/cmake/android.toolchain.cmake \
-DANDROID_TOOLCHAIN=clang++ \
-DANDROID_ABI=arm64-v8a \
-DANDROID_TARGET_SDK_VERSION=26 \
-DANDROID_MIN_SDK_VERSION=24 \
-DBUILD_JAVA=ON -DBUILD_FAT_JAVA_LIB=ON DBUILD_ZLIB=ON \
-D CMAKE_BUILD_TYPE=Release \
-D ANDROID_NATIVE_API_LEVEL=24 \
-DANDROID_COMPILE_SDK_VERSION=26 \
-D ANDROID_STL=c++_shared \
-D WITH_CUDA=OFF \
-D WITH_MATLAB=OFF \
-D BUILD_ANDROID_EXAMPLES=OFF -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=ON -D BUILD_SHARED_LIBS=OFF -DBUILD_ANDROID_PROJECTS=OFF -DBUILD_JNI=ON \
-DWITH_OPENCL=ON -DWITH_OPENGL=ON \
-DANT_HOME=/usr/share/ant -DJAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 -DANT_EXECUTABLE=/bin/ant \
-DSTRIP=/home/flavio/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip \
..

Extract from modules/java/android_sdk/CMakeList.txt:

project(${the_module}_android)

if(ANDROID_EXECUTABLE)
  set(OPENCV_JAVA_DIR "${OpenCV_BINARY_DIR}/android_sdk" CACHE INTERNAL "")
else()  # gradle
  set(OPENCV_JAVA_DIR "${ANDROID_BUILD_BASE_DIR}/opencv" CACHE INTERNAL "")
endif()
set(OPENCV_ANDROID_LIB_DIR "${OPENCV_JAVA_DIR}" CACHE INTERNAL "")  # for OpenCV samples

message (STATUS "OPENCV_JAVA_DIR = ${OPENCV_JAVA_DIR}")
message (STATUS "ANDROID_BUILD_BASE_DIR = ${ANDROID_BUILD_BASE_DIR}")
message (STATUS "OpenCV_BINARY_DIR= ${OpenCV_BINARY_DIR}")
file(REMOVE_RECURSE "${OPENCV_JAVA_DIR}")
file(MAKE_DIRECTORY "${OPENCV_JAVA_DIR}/bin")
set(java_src_dir "${OPENCV_JAVA_DIR}/src")
file(MAKE_DIRECTORY "${java_src_dir}")

Cmake terminal output

-- Check for working CXX compiler: /home/flavio/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
-- Check for working CXX compiler: /home/flavio/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /home/flavio/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
-- Check for working C compiler: /home/flavio/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Detected processor: aarch64
CMake Warning at cmake/OpenCVUtils.cmake:752 (message):
  Unexpected option: WITH_OPENGL (=ON)

  Condition: IF (NOT;ANDROID;AND;NOT;WINRT)
Call Stack (most recent call first):
  CMakeLists.txt:308 (OCV_OPTION)


-- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.18", minimum required is "2.7") 
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3.2") 
-- Looking for ccache - not found
<---------- Performed Tests have been cut out from this output to meet character-limit of stackoverflow questions ----------->
-- ANDROID: TRUE
-- Update variable ANDROID_SDK_ROOT from environment: /home/flavio/Android/Sdk
-- Update variable ANDROID_HOME from environment: /home/flavio/Android/Sdk
Android: Projects builds are DISABLED
-- Looking for dlerror in dl
-- Looking for dlerror in dl - found
-- ADE: Download: v0.1.1f.zip
-- 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.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': /home/flavio/Downloads/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
-- OPENCV_JAVA_DIR = /opencv
-- ANDROID_BUILD_BASE_DIR = 
-- OpenCV_BINARY_DIR= /home/flavio/Downloads/opencv/build_manual
CMake Error at modules/java/android_sdk/CMakeLists.txt:15 (file):
  file problem creating directory: /opencv/bin


CMake Error at modules/java/android_sdk/CMakeLists.txt:17 (file):
  file problem creating directory: /opencv/src


CMake Error: Could not open file for write in copy operation /opencv/AndroidManifest.xml.tmp
CMake Error: : System Error: No such file or directory
CMake Error at modules/java/android_sdk/CMakeLists.txt:121 (configure_file):
  configure_file Problem configuring file


CMake Error: Could not open file for write in copy operation /opencv/build.gradle.tmp
CMake Error: : System Error: No such file or directory
CMake Error at modules/java/android_sdk/CMakeLists.txt:121 (configure_file):
  configure_file Problem configuring file


CMake Error: Could not open file for write in copy operation /opencv/res/values/attrs.xml.tmp
CMake Error: : System Error: No such file or directory
CMake Error at modules/java/android_sdk/CMakeLists.txt:121 (configure_file):
  configure_file Problem configuring file


CMake Error: Could not open file for write in copy operation /opencv/libcxx_helper/CMakeLists.txt.tmp
CMake Error: : System Error: No such file or directory
CMake Error at modules/java/android_sdk/CMakeLists.txt:133 (configure_file):
  configure_file Problem configuring file


CMake Error: Could not open file for write in copy operation /opencv/libcxx_helper/dummy.cpp.tmp
CMake Error: : System Error: No such file or directory
CMake Error at modules/java/android_sdk/CMakeLists.txt:133 (configure_file):
  configure_file Problem configuring file


CMake Error: Could not open file for write in copy operation /opencv/build.gradle.tmp
CMake Error: : System Error: No such file or directory
CMake Error at modules/java/android_sdk/CMakeLists.txt:160 (configure_file):
  configure_file Problem configuring file


-- Android OpenCV Manager is ignored
-- 
-- General configuration for OpenCV 4.5.1 =====================================
--   Version control:               unknown
-- 
--   Platform:
--     Timestamp:                   2022-03-20T09:57:50Z
--     Host:                        Linux 5.13.0-35-generic x86_64
--     Target:                      Android 1 aarch64
--     CMake:                       3.16.3
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               Release
-- 
--   CPU/HW features:
--     Baseline:                    NEON FP16
-- 
--   C/C++:
--     Built as dynamic libs?:      NO
--     C++ standard:                11
--     C++ Compiler:                /home/flavio/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++  (ver 9.0)
--     C++ flags (Release):         -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security     -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Qunused-arguments    -fvisibility=hidden -fvisibility-inlines-hidden -O2 -DNDEBUG   -DNDEBUG
--     C++ flags (Debug):           -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security     -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Qunused-arguments    -fvisibility=hidden -fvisibility-inlines-hidden -O0   -DDEBUG -D_DEBUG
--     C Compiler:                  /home/flavio/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
--     C flags (Release):           -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Qunused-arguments    -fvisibility=hidden -fvisibility-inlines-hidden -O2 -DNDEBUG   -DNDEBUG
--     C flags (Debug):             -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Qunused-arguments    -fvisibility=hidden -fvisibility-inlines-hidden -O0   -DDEBUG -D_DEBUG
--     Linker flags (Release):      -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments   -Wl,--as-needed  
--     Linker flags (Debug):        -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments   -Wl,--as-needed  
--     ccache:                      NO
--     Precompiled headers:         NO
--     Extra dependencies:          ade dl m log
--     3rdparty dependencies:       libcpufeatures ittnotify libprotobuf zlib libjpeg-turbo libwebp libpng libtiff libopenjp2 IlmImf quirc tegra_hal
-- 
--   OpenCV modules:
--     To be built:                 calib3d core dnn features2d flann gapi highgui imgcodecs imgproc java ml objdetect photo stitching ts video videoio
--     Disabled:                    world
--     Disabled by dependency:      -
--     Unavailable:                 python2 python3
--     Applications:                tests
--     Documentation:               NO
--     Non-free algorithms:         NO
-- 
--   Android NDK:                   /home/flavio/Android/Sdk/ndk/21.0.6113669 (ver 21.0.6113669)
--     Android ABI:                 arm64-v8a
--     NDK toolchain:               aarch64-linux-android-4.9
--     STL type:                    c++_shared
--     Native API level:            24
--   Android SDK:                   not used, projects are not built
-- 
--   GUI: 
--     OpenGL support:              NO
-- 
--   Media I/O: 
--     ZLib:                        build (ver 1.2.11)
--     JPEG:                        build-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)
--     OpenEXR:                     build (ver 2.3.0)
--     HDR:                         YES
--     SUNRASTER:                   YES
--     PXM:                         YES
--     PFM:                         YES
-- 
--   Video I/O:
-- 
--   Parallel framework:            pthreads
-- 
--   Trace:                         YES (with Intel ITT)
-- 
--   Other third-party libraries:
--     Custom HAL:                  YES (carotene (ver 0.0.1))
--     Protobuf:                    build (3.5.1)
-- 
--   OpenCL:                        YES (no extra features)
--     Include path:                /home/flavio/Downloads/opencv/3rdparty/include/opencl/1.2
--     Link libraries:              Dynamic load
-- 
--   Python (for build):            /usr/bin/python2.7
-- 
--   Java:                          export all functions
--     ant:                         /bin/ant (ver )
--     Java wrappers:               YES
--     Java tests:                  NO
-- 
--   Install to:                    /home/flavio/Downloads/opencv/build_manual/install
-- -----------------------------------------------------------------
-- 
-- Configuring incomplete, errors occurred!
See also "/home/flavio/Downloads/opencv/build_manual/CMakeFiles/CMakeOutput.log".
See also "/home/flavio/Downloads/opencv/build_manual/CMakeFiles/CMakeError.log".

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑着哭最痛 2025-01-22 10:35:16

我遇到了类似的错误,因此我通过打开 -DBUILD_ANDROID_PROJECTS=ON 来修复它,并修复所有不兼容的“SDK TOOL 版本”或“gradle 版本”。然后gradle可以在modules/java/android_sdk/CMakeLists.txt:15中设置所有必要的路径,例如ANDROID_BUILD_BASE_DIR

例如更新SDK Tools:打开android studio >设置>系统设置> Android SDK > SDK工具>>更新Android SDK构建工具和NDK(并排)

I had similar errors, so I fixed it by turning on -DBUILD_ANDROID_PROJECTS=ON and fix all incompatible "SDK TOOL version" or "gradle versions". Then gradle can set all necessary paths like ANDROID_BUILD_BASE_DIR in modules/java/android_sdk/CMakeLists.txt:15.

For example to update SDK Tools: Open android studio > setting > system settings > Android SDK > SDK Tools > update Android SDK build tools and NDK(side by side)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文