CmakeList中链接libopencv.so。编译时报错。
具体报错代码:
> Task :library-native:buildCMakeDebug[arm64-v8a] FAILED
C/C++: ninja: Entering directory `G:\AndroidStudioProjects\HelloAndroid\library-native\.cxx\Debug\1t442u5r\arm64-v8a
C/C++: ld: error: found local symbol
C/C++: ld: error: found local symbol
C/C++: ld: error: found local symbol
C/C++: ld: error: found local symbol
C/C++: ld: error: found local symbol
C/C++: ld: error: found local symbol
C/C++: ld: error: found local symbol
C/C++: clang++: error: linker command failed with exit code 1 (use -v to see invocation)
C/C++: ld: error: found local symbol
网上看到了很多解决办法,都来源于这篇文章:local symbol '__bss_start' in global part of symbol table" only in Android NDK aarch64 build]
最后文章中有人提到了,更换ndk版本。经测试,更换NDK到21.4.xxx版本及以下都可以编译。如下图:
该问题仅存在于arm64-v8a中,armeabi-v7a中并无问题。