Why is NDK generating shared library for x86 with text relocation even after setting -fPIC flag?

∥☆過路亽.° 提交于 2019-12-10 14:40:16

问题


I'm using PJSIP/PJSUA2 with Android project. I've built libpjsua2.so shared library for armeabi, armeabi-v7 and x86 with -fPIC flag. The libs are also linked with OpenSSL 1.0.2h statically which were built with -fPIC flag. All libs loads properly on device with Android 4.4 to 6.0 except x86 in which it shows text relocation error. Build script builds two versions of the lib-

android-9 (for API level upto 15 and no x86) android-16 (for API level 16+)

Why on x86, text relocation is occurring even with -fPIC flag?


回答1:


Today, I got the same error messages when testing my app with Android 7.0 on a Nexus 5 Emulator. I solved my issue by changing the targetSDKVersion to 22.

This is just a short term workaround..



来源:https://stackoverflow.com/questions/38434510/why-is-ndk-generating-shared-library-for-x86-with-text-relocation-even-after-set

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