You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try to build OpenCV for Android by my own on my Mac, inspired by this log I installed the exact NDK android-ndk-r10e
and I was forced to install ninja by brew install ninja
but currently I see
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set
But I need some explanation for buildenv python ../opencv/platforms/android/build_sdk.py --build_doc --extra_pack 2.4.13:/opt/android/pack_2.4/ . ../opencv
What is
buildenv how does it looks like ?
--extra_pack what is the content of /opt/android/pack_2.4/ ?
Thank you for the clarification. I only works on command line, and ninja works on any directory which contains a build.ninjafile.
With python ../opencv/platforms/android/build_sdk.py . ../opencv I get
Executing: ['cmake', '-GNinja', "-DCMAKE_TOOLCHAIN_FILE='/Users/hannes/git/openCV/opencv/platforms/android/android.toolchain.cmake'", '-DWITH_OPENCL=OFF', '-DWITH_CUDA=OFF', '-DWITH_IPP=OFF', '-DBUILD_EXAMPLES=OFF', '-DBUILD_TESTS=OFF', '-DBUILD_PERF_TESTS=OFF', '-DBUILD_DOCS=OFF', '-DBUILD_ANDROID_EXAMPLES=ON', '-DINSTALL_ANDROID_EXAMPLES=ON', '-DANDROID_STL=gnustl_static', '-DANDROID_NATIVE_API_LEVEL=9', "-DANDROID_ABI='armeabi-v7a with NEON'", '-DWITH_TBB=ON', '-DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.8', '/Users/hannes/git/openCV/opencv', '-DNDK_CCACHE=ccache', '-DBUILD_TESTS=ON', '-DINSTALL_TESTS=ON']
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "Ninja".
Problem is here. CMake is not able to find it.
Does "ninja --version" command work? (without any additional paths)
BTW, Also you could try removing option "-GNinja" from the build script (CMake should use "make" tool instead)
Update 2018-01-04: Looks like modern CMake versions don't want to search "ninja" automatically. You need to pass this option: -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja
As suggested, I removed both lines -GNinja from ./opencv/platforms/android/build_sdk.py
.. yes it starts ! But after 30 seconds, I see after configuring and generation this now
-- Install to: /Users/hannes/git/openCV/build/o4a/install
--
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/hannes/git/openCV/build/o4a
Executing: ['ninja']
ninja: error: loading 'build.ninja': No such file or directory
Traceback (most recent call last):
File "../opencv/platforms/android/build_sdk.py", line 303, in
builder.build_library(abi, do_install)
File "../opencv/platforms/android/build_sdk.py", line 149, in build_library
execute(["ninja"])
File "../opencv/platforms/android/build_sdk.py", line 20, in execute
raise Fail("Child returned: %s" % retcode) main.Fail: Child returned: 1
Why is there ninja used, when it build without (more) too ? It adds more complexity, and as I see OpenCV has enough of it
The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
My motivation/vision is to make is usable out of the box with Android Studio 3 without copy anything somewhere. (or at least to help to go in this direction)
But when I see the spirit in #10288 I've no chance to do so, so there is no need anymore to understand exactly the current build process and help to improve it.
Currently I'm a copy-guy as all other does. -sad-
If there is any change in this spirit, I hope I will mention it and I will help to improve it.
What should be done here for Android
any commit should be tested prior merge for all platforms with eg Travis, like in Tensorflow
build an Android lib and deploy to jcenter or similar
Android sample project with Android Studio
no delivery with zip, just jcenter or similar to have something like implements "com.opencv.lib:3.4.0" in build.gradle
The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
@hannesa2 , make sure you have set ANDROID_SDK and ANDROID_NDK environment variables correctly. Please attach the output of your script here so that someone could take a look at the details.
@hannesa2 I fixed this by always using older tools but that is a hassel so I am writing a custom script to handle creating the library on the command line.
Activity
alalek commentedon Dec 28, 2017
--extra-pack: it is for bundling OpenCV 2.4 into OpenCV Manager for Android package (deprecated component)hannesa2 commentedon Dec 28, 2017
Thank you for the clarification. I only works on command line, and
ninjaworks on any directory which contains abuild.ninjafile.With
python ../opencv/platforms/android/build_sdk.py . ../opencvI getAny help is welcome !
alalek commentedon Dec 28, 2017
Problem is here. CMake is not able to find it.
Does "ninja --version" command work? (without any additional paths)
BTW, Also you could try removing option "-GNinja" from the build script (CMake should use "make" tool instead)
Update 2018-01-04: Looks like modern CMake versions don't want to search "ninja" automatically. You need to pass this option: -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja
hannesa2 commentedon Dec 28, 2017
ninja --versionworks properly.As suggested, I removed both lines
-GNinjafrom./opencv/platforms/android/build_sdk.py.. yes it starts ! But after 30 seconds, I see after configuring and generation this now
Why is there
ninjaused, when it build without (more) too ? It adds more complexity, and as I see OpenCV has enough of ithannesa2 commentedon Dec 28, 2017
after the next change

I run into this
Any ideas ?
alalek commentedon Dec 28, 2017
"next" change with "ninja" should be "make" (or "cmake --build .")
hannesa2 commentedon Dec 28, 2017
Yes ! It builds now. 👍
Make it sense to make a PR with my changes, or is it just for "private purpose" ?
alalek commentedon Dec 28, 2017
"ninja" is faster than "make", so we prefer to use it. Usually there are no problems to properly install "ninja".
hannesa2 commentedon Dec 28, 2017
Next issue is how to specify
lib_target_sdk_target?alalek commentedon Dec 29, 2017
I believe this can be fixed with old Android SDK only (we using some snapshot from 2015/2016 year):
BTW, modern version of "build tools" component requires Java 8.
Also you could try these changes: #10288
hannesa2 commentedon Dec 29, 2017
My motivation/vision is to make is usable out of the box with Android Studio 3 without copy anything somewhere. (or at least to help to go in this direction)
But when I see the spirit in #10288 I've no chance to do so, so there is no need anymore to understand exactly the current build process and help to improve it.
Currently I'm a copy-guy as all other does. -sad-
If there is any change in this spirit, I hope I will mention it and I will help to improve it.
What should be done here for Android
implements "com.opencv.lib:3.4.0"in build.gradlemshabunin commentedon Dec 29, 2017
@hannesa2 , please check this issue: #5003
sergiomarqmoura commentedon Dec 29, 2017
@hannesa2 could you build it in the end?
hannesa2 commentedon Dec 29, 2017
sorry no, even fork https://github.com/10imaging/opencv with command
build.shshows meIf someone knows how to fix, we should see it in main repo not in any fork.
mshabunin commentedon Dec 29, 2017
@hannesa2 , make sure you have set
ANDROID_SDKandANDROID_NDKenvironment variables correctly. Please attach the output of your script here so that someone could take a look at the details.victorv commentedon Jul 11, 2018
@hannesa2 I fixed this by always using older tools but that is a hassel so I am writing a custom script to handle creating the library on the command line.