opencv需要gunstl

梦想腾飞 2018-10-07

opencv 3.4.3版本,在android studio中编译,

build.gradle 
externalNativeBuild {
cmake {
cppFlags "-std=c++11 -frtti -fexceptions"
abiFilters "arm64-v8a"
arguments '-DANDROID_STL=gnustl_shared'
//arguments "-DANDROID_ALLOW_UNDEFINED_SYMBOLS=TRUE"
}
}

发现找不到libgunstl_shared.so

Expected NDK STL shared object file at <NDK>/soureces/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/libgunstl_shared.so

 打开ndk(版本为r18)目录下的CHANGELOG.md,有如下内容

CHANGELOG.md 
* gnustl, gabi++, and stlport have been removed.

 下载NDK r16,设置为当前工程的NDK

File --> Project Structure --> SDK Location --> Android NDK Location

 编译通过

坑在于:文档并没有说明OpenCV编译需要gnustl,有人是把OpenCV的库用libc++重新编译了,这个工作对于一般的库用户来说太难了。

参考:https://stackoverflow.com/questions/52410712/ndk-problems-after-gnustl-has-been-removed-from-the-ndk-revision-r18

相关推荐

cherayliu / 0评论 2020-06-13