为什么即使设置了-fPIC标志,NDK仍会为带文本重定位的x86生成共享库? [英] Why is NDK generating shared library for x86 with text relocation even after setting -fPIC flag?

查看:176
本文介绍了为什么即使设置了-fPIC标志,NDK仍会为带文本重定位的x86生成共享库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将PJSIP/PJSUA2用于Android项目.我已经使用-fPIC标志为armeabi,armeabi-v7和x86构建了libpjsua2.so共享库.这些库也与通过-fPIC标志构建的OpenSSL 1.0.2h静态链接.除了显示文本重定位错误的x86之外,所有库均已在装有Android 4.4至6.0的设备上正确加载. 构建脚本构建两个版本的lib-

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(适用于API级别最高为15且没有x86) android-16(适用于API级别16 +)

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

为什么在x86上即使使用-fPIC标志也会发生文本重定位?

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

推荐答案

今天,当我在Nexus 5模拟器上使用Android 7.0测试我的应用程序时,出现了相同的错误消息.我通过将targetSDKVersion更改为22解决了我的问题.

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..

这篇关于为什么即使设置了-fPIC标志,NDK仍会为带文本重定位的x86生成共享库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆