build opencv 3.4.x with NDK 20

不想你离开。 提交于 2019-11-28 22:31:15
$ git clone https://github.com/opencv/opencv.git

$ cd opencv

$ mkdir build-android && cd build-android


$ cmake -DCMAKE_TOOLCHAIN_FILE=/home/lqian/Android/Sdk/ndk/20.0.5594570/build/cmake/android.toolchain.cmake -DANDROID_NDK=/home/lqian/Android/Sdk/ndk/20.0.5594570/ ../ -DANDROID_NATIVE_API_LEVEL=19 -DANDROID_ABI=armeabi-v7a

$ make -j4

$ $ ls lib/armeabi-v7a/ -l
total 54864
-rw-rw-r--. 1 lqian lqian 28169394 Aug 29 05:01 libopencv_core.a
-rw-rw-r--. 1 lqian lqian  2778042 Aug 29 05:02 libopencv_imgcodecs.a
-rw-rw-r--. 1 lqian lqian 25225452 Aug 29 05:02 libopencv_imgproc.a

#此处的CMAKE_TOOLCHAIN_FILE一定是NDK目录下的,

opencv自带的编译报错

CMake Error at platforms/android/android.toolchain.cmake:628 (message):
  Could not find any working toolchain in the NDK.  Probably your Android NDK
  is broken.
Call Stack (most recent call first):
  /usr/share/cmake/Modules/CMakeDetermineSystem.cmake:93 (include)
  CMakeLists.txt:127 (project)

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!