How to build opencv from source for android studio on windows? - android

I have to to build opencv from source due to opencv_contrib. Although I have tried many tutorials, I faild to build opencv from source.
The code I used:
cmake -G"MinGW Makefiles" -DANDROID_NDK=D:/androidNDK/android-ndk-r22b -DANDROID_SDK_ROOT=D:/android-sdk -DCMAKE_TOOLCHAIN_FILE=D:/androidNDK/android-ndk-r22b/build/cmake/android.toolchain.cmake -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF D:/OpenCV455/opencv-4.5.5
General configuration:
-- General configuration for OpenCV 4.5.5 =====================================
-- Version control: unknown
--
-- Platform:
-- Timestamp: 2022-11-19T00:58:08Z
-- Host: Windows 10.0.19043 AMD64
-- Target: Android 1 armv7-a
-- CMake: 3.21.3
-- CMake generator: MinGW Makefiles
-- CMake build tool: D:/MinGW1/mingw64/bin/mingw32-make.exe
-- Configuration: Release
--
-- CPU/HW features:
-- Baseline: NEON
-- requested: DETECT
--
-- C/C++:
-- Built as dynamic libs?: NO
-- C++ standard: 11
-- C++ Compiler: D:/androidNDK/android-ndk-r22b/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe (ver 11.0.5)
-- C++ flags (Release): -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -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 -Wno-deprecated-enum-enum-conversion -Wno-deprecated-anon-enum-enum-conversion -fdiagnostics-show-option -Qunused-arguments -fvisibility=hidden -fvisibility-inlines-hidden -Oz -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -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 -Wno-deprecated-enum-enum-conversion -Wno-deprecated-anon-enum-enum-conversion -fdiagnostics-show-option -Qunused-arguments -fvisibility=hidden -fvisibility-inlines-hidden -O0 -fno-limit-debug-info -DDEBUG -D_DEBUG
-- C Compiler: D:/androidNDK/android-ndk-r22b/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
-- C flags (Release): -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -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 -Wno-deprecated-enum-enum-conversion -Wno-deprecated-anon-enum-enum-conversion -fdiagnostics-show-option -Qunused-arguments -fvisibility=hidden -fvisibility-inlines-hidden -Oz -DNDEBUG -DNDEBUG
-- C flags (Debug): -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -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 -Wno-deprecated-enum-enum-conversion -Wno-deprecated-anon-enum-enum-conversion -fdiagnostics-show-option -Qunused-arguments -fvisibility=hidden -fvisibility-inlines-hidden -O0 -fno-limit-debug-info -DDEBUG -D_DEBUG
-- Linker flags (Release): -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Qunused-arguments -Wl,--as-needed
-- Linker flags (Debug): -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Qunused-arguments -Wl,--as-needed
-- ccache: NO
-- Precompiled headers: NO
-- Extra dependencies: z dl m log
-- 3rdparty dependencies: libcpufeatures libprotobuf ade ittnotify 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 video videoio
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: python2 python3 ts
-- Applications: android_examples
-- Documentation: NO
-- Non-free algorithms: NO
--
-- Android NDK: D:/androidNDK/android-ndk-r22b (ver 22.1.7171670)
-- Android ABI: armeabi-v7a
-- NDK toolchain: arm-linux-androideabi-clang
-- STL type: c++_static
-- Native API level: 16
-- Android SDK: D:/android-sdk (tools: 25.2.5 build tools: 33.0.0)
-- android tool: D:/android-sdk/tools/android.bat
-- SDK target: android-21
-- Projects build scripts: Ant/Eclipse compatible
--
-- GUI: NONE
--
-- Media I/O:
-- ZLib: z (ver 1.2.11)
-- JPEG: build-libjpeg-turbo (ver 2.1.2-62)
-- WEBP: build (ver encoder: 0x020f)
-- PNG: build (ver 1.6.37)
-- TIFF: build (ver 42 - 4.2.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:
--
-- Parallel framework: pthreads
--
-- Trace: YES (with Intel ITT)
--
-- Other third-party libraries:
-- Custom HAL: YES (carotene (ver 0.0.1))
-- Protobuf: build (3.19.1)
--
-- Python (for build): D:/Python37/python.exe
--
-- Java: export all functions
-- ant: D:/apache-ant-1.9.16/bin/ant.bat (ver 1.9.16)
-- Java wrappers: YES
-- Java tests: NO
--
-- Install to: D:/OpenCV455/buil36/install
-----------------------------------------------------------------**
The errors I get after running 'mingw32-make':
[97%] Built target opencv_java_android_source_copy
[97%]Generating OpenCV Android library project. SDK target:
[97%] Bui1ding OpenCV Android library project
[subant] No sub-builds to iterate on
Target '-code-gen' failed with message 'The following error occurred while executing this line:
D:\android-sdk\tools\ant\build.xml:655: null returned: -1073741819'.
Cannot execute '-compile' - '-code-gen' failed or was not executed.
Cannot execute '-dex' - '-compile' failed or was not executed.
Cannot execute '-package' - '-dex' failed or was not executed.
Cannot execute '-do-debug' - '-package' failed or was not executed.
Cannot execute 'debug' - '-do-debug' failed or was not executed.
BUILD FAILED
D:\android-sdk\tools\ant\build.xml:649: The following error occurred while executing this line:
D:\android-sdk\tools\ant\build.xml:655: null returned: -1073741819
Total time: 2 seconds
mingw32-make[2]: *** [modules\java\android_sdk\CMakeFiles\opencv_java_android.dir\build.make:77: bin/classes.jar] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:2689: modules/java/android_sdk/CMakeFiles/opencv_java_android.dir/all] Error 2
I get similar errors with ninja.
[1568/1595] Building OpenCV Android library project
FAILED: bin/classes.jar CMakeFiles/dephelper/opencv_java_android D:/OpenCV455/build36/bin/classes.jar D:/OpenCV455/build36/CMakeFiles/dephelper/opencv_java_android
cmd.exe /C "cd /D D:\OpenCV455\build36\android_sdk && D:\apache-ant-1.9.16\bin\ant.bat -q -noinput -k debug -Djava.target=1.6 -Djava.source=1.6 && D:\cmake-3.21.3\bin\cmake.exe -E touch D:/OpenCV455/build36/CMakeFiles/dephelper/opencv_java_android"
[subant] No sub-builds to iterate on
Target '-code-gen' failed with message 'The following error occurred while executing this line:
D:\android-sdk\tools\ant\build.xml:655: null returned: -1073741819'.
Cannot execute '-compile' - '-code-gen' failed or was not executed.
Cannot execute '-dex' - '-compile' failed or was not executed.
Cannot execute '-package' - '-dex' failed or was not executed.
Cannot execute '-do-debug' - '-package' failed or was not executed.
Cannot execute 'debug' - '-do-debug' failed or was not executed.
BUILD FAILED
D:\android-sdk\tools\ant\build.xml:649: The following error occurred while executing this line:
D:\android-sdk\tools\ant\build.xml:655: null returned: -1073741819
Total time: 1 second
[1572/1595] Building CXX object modules/gapi/CMakeFiles/opencv_perf_gapi.dir/perf/gpu/gapi_core_perf_tests_gpu.cpp.o
ninja: build stopped: subcommand failed.
here is the code with error.
in build.ninja file:
# Custom command for bin\classes.jar
build bin/classes.jar CMakeFiles/dephelper/opencv_java_android | ${cmake_ninja_workdir}bin/classes.jar ${cmake_ninja_workdir}CMakeFiles/dephelper/opencv_java_android: CUSTOM_COMMAND CMakeFiles/dephelper/opencv_java_android_source_copy android_sdk/build.xml android_sdk/local.properties android_sdk/proguard-project.txt android_sdk/project.properties android_sdk/AndroidManifest.xml || modules/java/android_sdk/opencv_java_android_source_copy modules/java_bindings_generator/gen_opencv_java_source
COMMAND = cmd.exe /C "cd /D D:\OpenCV455\build34\android_sdk && D:\apache-ant-1.9.16\bin\ant.bat -q -noinput -k debug -Djava.target=1.6 -Djava.source=1.6 && D:\cmake-3.21.3\bin\cmake.exe -E touch D:/OpenCV455/build34/CMakeFiles/dephelper/opencv_java_android"
DESC = Building OpenCV Android library project
restat = 1
in build.cmake file:
bin/classes.jar: CMakeFiles/dephelper/opencv_java_android_source_copy
bin/classes.jar: android_sdk/build.xml
bin/classes.jar: android_sdk/local.properties
bin/classes.jar: android_sdk/proguard-project.txt
bin/classes.jar: android_sdk/project.properties
bin/classes.jar: android_sdk/AndroidManifest.xml
#$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --blue --bold --progress-dir=D:\OpenCV455\build41\CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building OpenCV Android library project"
cd /d D:\OpenCV455\build41\android_sdk && call D:\apache-ant-1.9.16\bin\ant.bat -q -noinput -k debug -Djava.target=1.6 -Djava.source=1.6
cd /d D:\OpenCV455\build41\android_sdk && D:\cmake-3.21.3\bin\cmake.exe -E touch D:/OpenCV455/build41/CMakeFiles/dephelper/opencv_java_android
CMakeFiles/dephelper/opencv_java_android: bin/classes.jar
in build.xml file:
<do-only-if-manifest-hasCode
elseText="hasCode = false. Skipping aidl/renderscript/R.java">
<echo level="info">Handling aidl files...</echo>
<aidl executable="${aidl}"
framework="${project.target.framework.aidl}"
libraryBinAidlFolderPathRefid="project.library.bin.aidl.folder.path"
genFolder="${gen.absolute.dir}"
aidlOutFolder="${out.aidl.absolute.dir}">
<source path="${source.absolute.dir}"/>
</aidl>
How to fix it?
I try to find solutions for similar problem, and here maybe the only similar one. The developer suggetsted that:
Android SDK: not used, projects are not built
After that message Java-based projects should be skipped completely.
Try to upgrade your Android SDK "BuildTools".
CMAKE_CONFIG_GENERATOR="MinGW Makefiles"
There is ninja build tool in Android NDK. Use cmake -GNinja ... for better experience.
I don't quite grasp how to do, My build tools version is 33.0.0.

I found two options:
shell script (reference)
Install Git Bash and set it in PATH (C:\Program Files\Git\cmd)
Install Cmake 3.24.3 and set it in PATH (C:\Program Files\CMake\bin)
Install java and set it in PATH (C:\Program Files\Java\jdk1.8.0_202\bin), create variable JAVA_HOME(C:\Program Files\Java\jdk1.8.0_202)
Install C compiler (mingw or Visual Studio or etc.). If you use mingw, then you will need to install: mingw32-base-bin,
mingw32-gcc-fortran-bin,
mingw32-gcc-g++-bin,
mingw32-gcc-objc-bin,
msys-base-bin. And then in PATH add C:\MinGW\bin
You may also need WSL for Windows, but I did it just through Git Bash
Create a script in an empty folder and name it build.sh:
#!/bin/bash -e
myRepo=$(pwd)
CMAKE_GENERATOR_OPTIONS=-G"Visual Studio 17 2022"
#CMAKE_GENERATOR_OPTIONS=-G"Visual Studio 15 2017 Win64"
#CMAKE_GENERATOR_OPTIONS=(-G"Visual Studio 16 2019" -A x64) # CMake 3.14+ is required
if [ ! -d "$myRepo/gstreamer" ]; then
echo "cloning gstreamer"
git clone https://github.com/GStreamer/gstreamer.git
else
cd gstreamer
git pull --rebase
cd ..
fi
if [ ! -d "$myRepo/openexr" ]; then
echo "cloning openexr"
git clone https://github.com/AcademySoftwareFoundation/openexr.git
else
cd openexr
git pull --rebase
cd ..
fi
if [ ! -d "$myRepo/openblas" ]; then
echo "cloning openblas"
git clone https://github.com/xianyi/OpenBLAS.git
else
cd openblas
git pull --rebase
cd ..
fi
if [ ! -d "$myRepo/eigen" ]; then
echo "cloning eigen"
git clone https://gitlab.com/libeigen/eigen.git
else
cd eigen
git pull --rebase
cd ..
fi
if [ ! -d "$myRepo/opencv" ]; then
echo "cloning opencv"
git clone https://github.com/opencv/opencv.git
else
cd opencv
git pull --rebase
cd ..
fi
if [ ! -d "$myRepo/opencv_contrib" ]; then
echo "cloning opencv_contrib"
git clone https://github.com/opencv/opencv_contrib.git
else
cd opencv_contrib
git pull --rebase
cd ..
fi
if [ ! -d "$myRepo/tesseract" ]; then
echo "cloning tesseract"
git clone https://github.com/tesseract-ocr/tesseract.git
else
cd tesseract
git pull --rebase
cd ..
fi
RepoSource=opencv
mkdir -p build_opencv
pushd build_opencv
CMAKE_OPTIONS=( -DBUILD_opencv_world:BOOL=OFF -DBUILD_JAVA:BOOL=ON -DBUILD_PERF_TESTS:BOOL=OFF -DBUILD_TESTS:BOOL=OFF -DBUILD_DOCS:BOOL=OFF -DWITH_CUDA:BOOL=OFF -DBUILD_EXAMPLES:BOOL=OFF -DINSTALL_CREATE_DISTRIB=ON)
set -x
cmake "${CMAKE_GENERATOR_OPTIONS[#]}" "${CMAKE_OPTIONS[#]}" -DOPENCV_EXTRA_MODULES_PATH="$myRepo"/opencv_contrib/modules -DCMAKE_INSTALL_PREFIX="$myRepo/install/$RepoSource" "$myRepo/$RepoSource"
echo "************************* $Source_DIR -->debug"
cmake --build . --config debug
echo "************************* $Source_DIR -->release"
cmake --build . --config release
cmake --build . --target install --config release
cmake --build . --target install --config debug
popd
Open Git Bash, open the folder with our script in it and write bash build.sh
If you have following error syntax error: unexpected end of file, then here is the solution
As result we get opencv_java460.dll and opencv-460.jar
Cmake with ninja (taken from here, but modified)
Here I will describe what I used to build (it's not a fact that this is all I need or specific versions, but it worked for me):
Install Python and set it in PATH (C:\Users\volce\AppData\Local\Programs\Python\Python311\Scripts\ и C:\Users\volce\AppData\Local\Programs\Python\Python311\)
Install java 8 and set it in PATH and in JAVA_HOME (see above)
Install Cmake 3.24.3 (I haven't tried it on another version) and set it in PATH (see above)
Download NDK r25, unzip and add an environment variable ANDROID_NDK: C:\Users\volce\AppData\Local\Android\Sdk\ndk\android-ndk-r25b
Download SDK tools r25.2.3, platform-tools r25.0.1 and build-tools r25.0.1
In the SDK folder, replace the contents of the tools, build-tools and platform-tools folders with the downloaded ones
Also, in PATH I added: C:\Users\volce\AppData\Local\Android\Sdk\tools and C:\Users\volce\AppData\Local\Android\Sdk\platform-tools
Adding environment variables: ANDROID_HOME and ANDROID_SDK_ROOT, where we specify the path to the SDK (for example, C:\Users\volce\AppData\Local\Android\Sdk)
Download ant and set it in PATH (C:\apache-ant-1.10.12\bin и C:\apache-ant-1.10.12\lib) and create ANT_HOME (C:\apache-ant-1.10.12)
Download MinGw, install the necessary packages and set it in PATH (see above)
Download and install Visual Studio
What did I do next
Created a folder for our task
In it we do git clone https://github.com/opencv/opencv.git and git clone https://github.com/opencv/opencv_contrib.git
In the folder with opencv, go to samples\android and in the file CMakeLists.txt deleting add_subdirectory(15-puzzle) (because of this, I did not build)
Create a build folder in our root folder (which was created for building opencv)
We go into it and do git clone https://github.com/ninja-build/ninja.git
Open Visual Studio. In it: Tools->Command Line->Developer Command Line. In the command line, write the path to the created folder build and write python configure.py --bootstrap. This is how we configured ninja
Being in our build folder in the console, we write the following(don't forget to change the paths to your own):
cmake -GNinja -DCMAKE_MAKE_PROGRAM=E:\OpenCV\build\ninja.exe -DCMAKE_INSTALL_PREFIX=E:\OpenCV\install -DANDROID_PROJECTS_BUILD_TYPE="ANT" -DBUILD_ANDROID_PROJECTS=ON -DBUILD_EXAMPLES:BOOL=OFF -DBUILD_TESTS:BOOL=OFF -DBUILD_PERF_TESTS:BOOL=OFF -DBUILD_JAVA=ON -DBUILD_opencv_java=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_FAT_JAVA_LIB=ON -DBUILD_PYTHON:BOOL=OFF -DINSTALL_ANDROID_EXAMPLES:BOOL=OFF -DANDROID_EXAMPLES_WITH_LIBS:BOOL=OFF -DBUILD_DOCS:BOOL=OFF -DWITH_OPENCL=ON -DANDROID_NDK_HOST_X64=ON -DANDROID_NDK=C:/Users/volce/AppData/Local/Android/Sdk/ndk/android-ndk-r25b/ -DANDROID_SDK=C:/Users/volce/AppData/Local/Android/Sdk -DCMAKE_TOOLCHAIN_FILE=C:/Users/volce/AppData/Local/Android/Sdk/ndk/android-ndk-r25b/build/cmake/android.toolchain.cmake -DANDROID_TOOLCHAIN=clang -DANDROID_STL=c++_static -DANDROID_ARM_NEON=ON -DANDROID_ABI='arm64-v8a, armeabi-v7a, x86_64, x86' -DANDROID_NDK_HOST_X64=ON -DBUILD_opencv_python3:BOOL=OFF -DBUILD_opencv_python2:BOOL=OFF -DOPENCV_EXTRA_MODULES_PATH=E:/OpenCV/opencv_contrib/modules -DOPENCV_ENABLE_NONFREE=ON -DANDROID_NATIVE_API_LEVEL=25 -DANDROID_TARGET_SDK_VERSION=32 -DANDROID_MIN_SDK_VERSION=21 E:\OpenCV\opencv
After execution , write ninja -j8 in console
After waiting for the execution of the previous command, we write ninja install
As result we get the OpenCV SDK for Android
How to integrate OpenCV 4.6.0 in your project -> https://www.youtube.com/watch?v=bR7lL886-uc

Related

Cross-compile OpenCV on Linux Host for Android Target: Errors during Cmake configuration

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".
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)

C/C++ configuration problem in android studio 4 after gradle sync

I am trying to integrate native (C++) OpenCV code into my project. I am following this project on github. After I click refresh linked C++ projects the compiler exits with exit code 1.
2:48 AM Gradle sync finished in 3 s 67 ms
2:48 AM C/C++ Configuration Problem
native-lib | debug | x86
Compiler exited with error code 1: /home/user/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -xc++ --target=i686-none-linux-android24 --gcc-toolchain=/home/user/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/user/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dnative_lib_EXPORTS -isystem /home/user/Downloads/forLinux/android studio/opencv-4.3.0-android-sdk/OpenCV-android-sdk/sdk/native/jni/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -O0 -fno-limit-debug-info -fPIC -std=gnu++11 -fpch-preprocess -v -dD -E
Android (5900059 based on r365631c) clang version 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 207d7abc1a2abf3ef8d4301736d6a7ebc224a290) (based on LLVM 9.0.8svn)
Target: i686-none-linux-android24
Thread model: posix
Dir: /home/user/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin
Found candidate GCC installation: /home/user/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/i686-linux-android/4.9.x
Found candidate GCC installation: /home/user/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x
Selected GCC installation: /home/user/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/i686-linux-android/4.9.x Candidate multilib: .;#m32
Selected multilib: .;#m32 clang++: error: no such file or directory: 'studio/opencv-4.3.0-android-sdk/OpenCV-android-sdk/sdk/native/jni/include'
The folder containing open-cv sdk had a space in its name. Removing the space solved the error.

build openh264 for android under linux

I'm trying to build openh264 to use on android
-I've the latest openh264 source from git
-I've ndk 17
-I'm using ubuntu 16.04
running
make OS=android NDKROOT=/home/r/aff/ndk TARGET=android-27 NDKLEVEL=27 sysroot=/home/r/aff/ndk/sysroot
I get the error:
r#r:~/aff/openh264$ make OS=android NDKROOT=/home/r/aff/ndk TARGET=android-27 NDKLEVEL=27 sysroot=/home/r/aff/ndk/sysroot/home/r/aff/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -O3 -DNDEBUG -DHAVE_NEON -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -DANDROID_NDK -fpic --sysroot=/home/r/aff/ndk/platforms/android-27/arch-arm -MMD -MP -DGENERATED_VERSION_HEADER -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc -I/home/r/aff/ndk/sysroot -Dandroid_getCpuIdArm=wels_getCpuIdArm -Dandroid_setCpuArm=wels_setCpuArm -Dandroid_getCpuCount=wels_getCpuCount -Dandroid_getCpuFamily=wels_getCpuFamily -Dandroid_getCpuFeatures=wels_getCpuFeatures -Dandroid_setCpu=wels_setCpu -I/home/r/aff/ndk/sources/android/cpufeatures -c -o codec/common/src/cpu-features.o /home/r/aff/ndk/sources/android/cpufeatures/cpu-features.c
In file included from /home/r/aff/ndk/sources/android/cpufeatures/cpu-features.c:64:0:
/home/r/aff/ndk/sources/android/cpufeatures/cpu-features.h:31:23: fatal error: sys/cdefs.h: No such file or directory
#include <sys/cdefs.h>
^
compilation terminated.
build/platform-android.mk:96: recipe for target 'codec/common/src/cpu-features.o' failed
make: *** [codec/common/src/cpu-features.o] Error 1
When in doubt, stop rolling your own build configurations and use a standalone toolchain (pay particular attention to the section at the bottom about "Building open source projects using standalone toolchains": https://developer.android.com/ndk/guides/standalone_toolchain
Changing from
TARGET=android-27 NDKLEVEL=27
to
TARGET=android-21 NDKLEVEL=21
solved this issue for me.

gradle build for android native project fails with "unable to open output file" error

I am trying to build an android native project using gradle. While the build passes for the architectures arm64-v8a, x86 and x86_64, it fails for armeabi-v7a with a unique error:
/{sdk-path}/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=15 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -frtti -fexceptions -Os -DNDEBUG -O2 -DNDEBUG -D_NDEBUG=1 -s -fPIC -Wdeprecated-declarations -std=c++14 -MD -MT CMakeFiles/acplocalnet.dir/src/main/cpp/HttpTransferCallbackHookImpl.cpp.o -MF CMakeFiles/acplocalnet.dir/src/main/cpp/HttpTransferCallbackHookImpl.cpp.o.d -o CMakeFiles/acplocalnet.dir/src/main/cpp/HttpTransferCallbackHookImpl.cpp.o -c /Users/acpl/workspace/ACPLocal_net_Android/net/project/android/acplocalnet/app/src/main/cpp/HttpTransferCallbackHookImpl.cpp
clang++: warning: argument unused during compilation: '-s' [-Wunused-command-line-argument]
error: unable to open output file '/apps/temp/HttpTransferCallbackHookImpl-baaa5e.s': 'No such file or directory'
1 error generated.
ninja: build stopped: subcommand failed.
The issue here is I am able to run this command and it builds the native libraries successfully when run the machine locally, but it fails when it is run through jenkins. The other amusing thing is that it fails only for the abi armeabi-v7a and passes for all other architectures.
I have verified the user, path and environment variables like ANDROID_HOME and ANDROID_NDK_HOME which are same when I run using the command line on the machine locally and when run using jenkins.
The command was not able to open the output files in the location "/apps/temp" as this directory was not present in the slave. This temp directory present in the jenkins master and was passed to the slave which was visible in the build variable TMP_DIR. Explicitly mentioning a valid temporary directory for the jenkins slave fixed the issue.

"qmake" and "make" QtRemoteObjects (from git) for Qt 5.7 Android on Windows 7 does not work

I have cloned the QtRemoteObjects repository from: http://code.qt.io/cgit/playground/qtremoteobjects.git/
on my Windows 7 using GitBash.exe.
The project files are download to "D:\Daten\Android\qtremoteobjects\". Based on the article on this website: https://www.kdab.com/qt-android-create-android-service-using-qt/ I run this command in GitBash:
$ cd d:/Daten/Android/qtremoteobjects/
$ git c:/Qt5.7.0/5.7/android_armv7/bin/qmake -r && make && make install
QMAKE PART
For the qmake part these errors show up:
Reading D:/Daten/Android/qtremoteobjects/tests/auto/cmake/cmake.pro
Das System kann den angegebenen Pfad nicht finden.
meaning the system could not find the given path. And the next two errors are:
WARNING: Failure to find: rep_server_source.h
Project MESSAGE: cmake executable not found. Not running CMake unit tests
First question: Why doesnt the system find the path for cmake.pro and rep_server_source.h and why isnt the cmake executable not found even though I have separately installed CMake.
MAKE PART
The next error that shows up is:
bash: make: command not found
As a solution to this I separated the qmake and make process. I first just ran qmake
$ git c:/Qt5.7.0/5.7/android_armv7/bin/qmake -r
and when qmake is finished (and the same errors as above still show up) i run mingw32-make.exe from Qt5.7->Tools in the qtremoteobjects folder:
$ c:/Qt5.7.0/Tools/mingw530_32/bin/mingw32-make.exe
and this is the result:
cd src/ && ( test -e Makefile || C:/Qt5.7.0/5.7/android_x86/bin/qmake.exe
D:/Daten/Android/qtremoteobjects/src/src.pro -o Makefile ) && C:/Qt5.7.0/Tools/mingw530_32/bin/mingw32-make -f Makefile
mingw32-make[1]: Entering directory 'D:/Daten/Android/qtremoteobjects/src'
cd remoteobjects/ && ( test -e Makefile || C:/Qt5.7.0/5.7/android_x86/bin/qmake.exe D:/Daten/Android/qtremoteobjects/src/remoteobjects/remoteobjects.pro -o Makefile ) && C:/Qt5.7.0/Tools/mingw530_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'D:/Daten/Android/qtremoteobjects/src/remoteobjects'
D:\Daten\Android\android-ndk-r10e/toolchains/x86-4.9/prebuilt/windows/bin/i686-linux-android-g++ -c -ffunction-sections -funwind-tables -O2 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -DANDROID -Wa,--noexecstack -std=c++11 -mfpmath=sse -O2 -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -Wno-psabi -W -Wvla -D_REENTRANT -fPIC -DQT_NO_XKBCOMMON -DQT_BUILD_REMOTEOBJECTS_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_URL_CAST_FROM_STRING -DQT_BUILD_REMOTEOBJECTS_LIB -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -Ic:/utils/openssl-android-master/include -I../../include -I../../include/QtRemoteObjects -I../../include/QtRemoteObjects/5.6.1 -I../../include/QtRemoteObjects/5.6.1/QtRemoteObjects -I. -IC:/Qt5.7.0/5.7/android_x86/include -IC:/Qt5.7.0/5.7/android_x86/include/QtNetwork -IC:/Qt5.7.0/5.7/android_x86/include/QtCore/5.7.0 -IC:/Qt5.7.0/5.7/android_x86/include/QtCore/5.7.0/QtCore -IC:/Qt5.7.0/5.7/android_x86/include/QtCore -I.moc -isystem D:/Daten/Android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem D:/Daten/Android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include -isystem D:/Daten/Android/android-ndk-r10e/platforms/android-9/arch-x86/usr/include -IC:/Qt5.7.0/5.7/android_x86/mkspecs/android-g++ -o .obj/qconnection_local_backend.obj qconnection_local_backend.cpp
Makefile:1720: recipe for target '.obj/qconnection_local_backend.obj' failed
process_begin: CreateProcess(NULL, D:\Daten\Android\android-ndk-r10e/toolchains/x86-4.9/prebuilt/windows/bin/i686-linux-android-g++ -c -ffunction-sections -funwind-tables -O2 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -DANDROID -Wa,--noexecstack -std=c++11 -mfpmath=sse -O2 -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -Wno-psabi -W -Wvla -D_REENTRANT -fPIC -DQT_NO_XKBCOMMON -DQT_BUILD_REMOTEOBJECTS_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_URL_CAST_FROM_STRING -DQT_BUILD_REMOTEOBJECTS_LIB -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -Ic:/utils/openssl-android-master/include -I../../include -I../../include/QtRemoteObjects -I../../include/QtRemoteObjects/5.6.1 -I../../include/QtRemoteObjects/5.6.1/QtRemoteObjects -I. -IC:/Qt5.7.0/5.7/android_x86/include -IC:/Qt5.7.0/5.7/android_x86/include/QtNetwork -IC:/Qt5.7.0/5.7/android_x86/include/QtCore/5.7.0 -IC:/Qt5.7.0/5.7/android_x86/include/QtCore/5.7.0/QtCore -IC:/Qt5.7.0/5.7/android_x86/include/QtCore -I.moc -isystem D:/Daten/Android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem D:/Daten/Android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include -isystem D:/Daten/Android/android-ndk-r10e/platforms/android-9/arch-x86/usr/include -IC:/Qt5.7.0/5.7/android_x86/mkspecs/android-g++ -o .obj/qconnection_local_backend.obj qconnection_local_backend.cpp, ...) failed.
make (e=2): Das System kann die angegebene Datei nicht finden.
mingw32-make[2]: *** [.obj/qconnection_local_backend.obj] Error 2
mingw32-make[2]: Leaving directory 'D:/Daten/Android/qtremoteobjects/src/remoteobjects'
Makefile:44: recipe for target 'sub-remoteobjects-make_first-ordered' failed
mingw32-make[1]: *** [sub-remoteobjects-make_first-ordered] Error 2
mingw32-make[1]: Leaving directory 'D:/Daten/Android/qtremoteobjects/src'
Makefile:46: recipe for target 'sub-src-make_first' failed
mingw32-make: *** [sub-src-make_first] Error 2
Second Question Why is make not successful here? what do these errors mean? What is wrong with '.obj/qconnection_local_backend.obj'
Is it because I am running make on Windows?
Thanks,

Categories

Resources