Ask Your Question

Revision history [back]

Cannot build Android libraries

After I have successfully built OpenCV as an iOS Framework with one command call, I thought building for Android would be same easy. It is not - despite many hours trying I still cannot build the android ABI libraries.

What I did so far:

  • building with opencv/platforms/android/build_sdk.py
  • using Android SDK with downgraded tools & platform-tools to 25.2.5
  • using r10 ndk
  • OpenCV 3.4.2 Release

There is something with compiler/options mismatch, I suppose. With original setup, cmake fails with c++11 not supported. Then after I add this line to the android.toolchain.cmake

set( CMAKE_CXX_FLAGS           "-std=c++11"                        CACHE STRING "c++ flags" )

It starts to really build something but there is a bunch of c/c++ specific errors which break the build. For example:

arm-linux-androideabi-gcc: error: unrecognized command line option '-Wsuggest-override'
ninja: build stopped: subcommand failed.

or

/works/me/opencv/cmake/checks/cpu_fp16.cpp: In function 'int test()':
/works/me/opencv/cmake/checks/cpu_fp16.cpp:21:5: error: 'float16x4_t' was not declared in this scope
     float16x4_t v_dst = vcvt_f16_f32(v_src);
     ^

etc.

Any hints what I'm doing wrong?