ffmpeg安卓x86平台编译错误(libavcodec.so: has text relocations)
2017-06-15 16:18
633 查看
最近本人研究ffmpeg编译,在使用ndk交叉编译x86平台的.so库文件后,加载使用时,出现错误 java.lang.UnsatisfiedLinkError: dlopen failed: /data/app/xxx.xxx.xxx-1/lib/x86/libavcodec.so: has text relocations
原因是android 6.0之后,系统做了限制。
“On previous versions of Android, if your app requested the system to load a shared library with text relocations, the system displayed a warning but still allowed the library to be loaded. Beginning in this release, the system rejects this library if your app’s target SDK version is 23 or higher. To help you detect if a library failed to load, your app should log the dlopen(3) failure, and include the problem description text that the dlerror(3) call returns. To learn more about handling text relocations, see this guide”
针对这个说法,网上很多朋友用降低targetSDK版本的方式来解决,但如果不降低如何解决呢?
从ffmpeg官网有问题单描述,如下:
官方描述中,x86平台会出现此问题,而armv7-a 、x86_64都没有这样的问题,所以只需要针对x86平台解决即可。
OK,可以通过编译时添加 –disable-asm参数解决,设置参数关闭汇编后,编译后.so文件就不存在text relocations了。
可以通过以下方式检查,so文件中是否存在text relocations。
如果存在text relocations,会出现类似以下
0x00000016 (TEXTREL) 0x0
如果grep不到TEXTREL,如下图:
参考:
https://trac.ffmpeg.org/ticket/4928
https://stackoverflow.com/questions/32845956/android-m-crash-java-lang-unsatisfiedlinkerror-dlopen-failed
https://stackoverflow.com/questions/32346402/libavcodec-so-has-text-relocations
相关文章推荐
- 配置编译linux下QT程序编译时的错误:QMAKESPEC has not been set, so configuration cannot be deduced.
- FFmpeg第一篇之Android平台上的so编译
- QT程序编译时的错误:QMAKESPEC has not been set, so configuration cannot be deduced.
- Linux ubuntu 14.04 x86_64平台 gcc编译错误 Error: unsupported instruction `mov' 及ld链接错误
- Qtopia-2.2.2在x86平台编译--错误修改总汇
- ffmpeg 编译时遇到的make:***[libavcodec-57.so]Errror 1问题
- ubuntu 平台 FFmpeg Android .so文件编译
- ffmpeg-0.11.1编译具体之libavcodec/codec_names.sh
- 果编译时候出现错误:QMAKESPEC has not been set, so configuration cannot be deduced.
- FFmpeg安卓平台编译
- QT程序编译时的错误:QMAKESPEC has not been set, so configuration cannot be deduced.
- 使用ubuntu14和ndk 编译ffmpeg在android平台的so动态库
- FFmpeg - 编译指定平台so文件(Android)
- linux下QT程序编译时的错误:QMAKESPEC has not been set, so configuration cannot be deduced.
- 编译vlc-android 提示错误:libavcodec versions 56 and later are not supported yet解决办法
- Window 平台 FFmpeg Android .so文件编译
- ffmpeg移植到Android平台为什么用编译libjnivideo.so和libjniaudio.so
- [转]VS2008在64位Windows平台上编译ArcEngine导致HRESULT:0x80040154 (REGDB_E_CLASSNOTREG)错误的解决办法
- ffmpeg0.61src/ffmpeg-0.6.1/libavcodec/avcodec.h