添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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 '_edata' in global part of symbol table in file G:/AndroidStudioProjects/HelloAndroid/library-native/libs/arm64-v8a/libopencv_java3.so
C/C++: ld: error: found local symbol '__end__' in global part of symbol table in file G:/AndroidStudioProjects/HelloAndroid/library-native/libs/arm64-v8a/libopencv_java3.so
C/C++: ld: error: found local symbol '__bss_end__' in global part of symbol table in file G:/AndroidStudioProjects/HelloAndroid/library-native/libs/arm64-v8a/libopencv_java3.so
C/C++: ld: error: found local symbol '_bss_end__' in global part of symbol table in file G:/AndroidStudioProjects/HelloAndroid/library-native/libs/arm64-v8a/libopencv_java3.so
C/C++: ld: error: found local symbol '__bss_start__' in global part of symbol table in file G:/AndroidStudioProjects/HelloAndroid/library-native/libs/arm64-v8a/libopencv_java3.so
C/C++: ld: error: found local symbol '_end' in global part of symbol table in file G:/AndroidStudioProjects/HelloAndroid/library-native/libs/arm64-v8a/libopencv_java3.so
C/C++: ld: error: found local symbol '__bss_start' in global part of symbol table in file G:/AndroidStudioProjects/HelloAndroid/library-native/libs/arm64-v8a/libopencv_java3.so
C/C++: clang++: error: linker command failed with exit code 1 (use -v to see invocation)
C/C++: ld: error: found local symbol '__bss_start' in global part of symbol table in file G:/AndroidStudioProjects/HelloAndroid/library-native/libs/arm64-v8a/libopencv_java3.so

网上看到了很多解决办法,都来源于这篇文章: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中并无问题。

分类:
Android
标签: