.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
来源:互联网 发布:hishop云商城源码 编辑:程序博客网 时间:2024/06/12 22:03
转载请标明出处:http://blog.csdn.net/xx326664162/article/details/52926274 文章出自:薛瑄的博客
你也可以查看我的其他同类文章,也会让你有一定的收货
首先说明出现下面这个错误的原因可能有很多,你也可以直接看下面的分析,来判断是不是和我一样的问题
介绍一下,在下面的环境中,解决这个问题使用的解决方法。
测试环境:
Galaxy Note3 Android 5.0
Android studio 2.2.2
gradle-2.14.1-all
NDK版本如下图:
项目的build.gradle如下:
android { compileSdkVersion 24 buildToolsVersion "24.0.3" defaultConfig { applicationId "com.firs.facedetecttosvr" minSdkVersion 19 targetSdkVersion 21 ndk { moduleName "libface_identify" abiFilters 'armeabi', 'armeabi-v7a' } } ...(部分省略) externalNativeBuild { ndkBuild { path 'src/main/jni/Android.mk' } }}
Android.mk配置如下
LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE := facetempLOCAL_SRC_FILES := libFiFacial.ainclude $(PREBUILT_STATIC_LIBRARY)include $(CLEAR_VARS)LOCAL_MODULE := jpegtempLOCAL_SRC_FILES := libjpeg.soinclude $(PREBUILT_SHARED_LIBRARY)include $(CLEAR_VARS)#LOCAL_SRC_TCP := ./tcpSock/maintcp.cpp ./tcpSock/CommLayerTcp.cpp ./tcpSock/NetAuth.cpp ./tcpSock/NetDeal.cpp ./tcpSock/NetPublic.cpp#LOCAL_SRC_TCP := maintcp.cpp CommLayerTcp.cpp NetAuth.cpp NetDeal.cpp NetPublic.cppLOCAL_MODULE := libface_identifyLOCAL_SRC_FILES := facelib.cpp public.cpp maintcp.cpp CommLayerTcp.cpp NetAuth.cpp NetDeal.cpp NetPublic.cpp gb2312.cpp#LOCAL_MODULE_FILENAME = libface_identifyLOCAL_SHARED_LIBRARIES := jpegtempLOCAL_STATIC_LIBRARIES := facetempLOCAL_LDLIBS := -llog -lstdc++include $(BUILD_SHARED_LIBRARY)
java代码调用so库的代码
static { // System.loadLibrary("stlport_shared"); // System.loadLibrary("jpeg"); System.loadLibrary("face_identify"); }
出现下面这个错误的原因可能有很多,接下来介绍一下,在上面的环境下,解决这个问题使用的解决方法。
崩溃时的logcat
10-25 19:12:49.217 23377-23377/? I/art: Late-enabling -Xcheck:jni10-25 19:12:49.587 23377-23377/com.firs.facedetecttosvr W/linker: /data/app/com.firs.facedetecttosvr-2/lib/arm/libjpeg.so has text relocations. This is wasting memory and prevents security hardening. Please fix.10-25 19:12:49.593 23377-23377/com.firs.facedetecttosvr D/Face_Identify: login in username[test] pwd[123456] nLen[68]10-25 19:12:49.593 23377-23377/com.firs.facedetecttosvr D/Face_Identify: send packType[1] msgtype[256] subTyep[1]10-25 19:12:49.601 23377-23377/com.firs.facedetecttosvr D/Face_Identify: xxxxxxxxxxxxx(10); Client moudle quit StartNetModule 6410-25 19:12:49.602 23377-23377/com.firs.facedetecttosvr D/Face_Identify: 3333333333(10); Client moudle quit StartNetModule 7010-25 19:12:49.602 23377-23377/com.firs.facedetecttosvr D/Face_Identify: 88888888888sleep(10); Client moudle quit StartNetModule 7210-25 19:12:49.608 23377-23413/com.firs.facedetecttosvr D/Face_Identify: iCliePort[32108] acClieIp[116.205.1.86]CreateTcpClient 47810-25 19:12:49.620 23377-23416/com.firs.facedetecttosvr D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true10-25 19:12:49.628 23377-23377/com.firs.facedetecttosvr D/ActivityThreadInjector: clearCachedDrawables.10-25 19:12:49.634 23377-23416/com.firs.facedetecttosvr I/Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: Nondeterministic_AU_msm8974_LA.BF.1.1.3_RB1__release_AU (I741a3d36ca) OpenGL ES Shader Compiler Version: E031.29.00.00 Build Date: 04/04/16 Mon Local Branch: mybranch19053788 Remote Branch: quic/LA.BF.1.1.3_rb1.12 Local Patches: NONE Reconstruct Branch: NOTHING10-25 19:12:49.645 23377-23416/com.firs.facedetecttosvr I/OpenGLRenderer: Initialized EGL, version 1.410-25 19:12:49.700 23377-23413/com.firs.facedetecttosvr D/Face_Identify: login in username[test] pwd[123456] nLen[68]10-25 19:12:49.700 23377-23413/com.firs.facedetecttosvr D/Face_Identify: send packType[1] msgtype[256] subTyep[1]10-25 19:12:49.700 23377-23414/com.firs.facedetecttosvr D/Face_Identify: TmpStrData.iFd[23] SNEDLEN[90] DoTcpSendThreadPool 73610-25 19:12:49.803 23377-23413/com.firs.facedetecttosvr D/Face_Identify: 00010010-25 19:12:49.803 23377-23413/com.firs.facedetecttosvr D/Face_Identify: packType 1 msgtype 256 subType 2 DoTcpClient 407 10-25 19:12:49.803 23377-23413/com.firs.facedetecttosvr D/Face_Identify: InStrProPack.head.index 65000 InStrProPack.head.dataLen 584 DoTcpClient 412 10-25 19:12:49.803 23377-23413/com.firs.facedetecttosvr D/Face_Identify: sizeof(InStrProPack.head)[19]10-25 19:12:49.803 23377-23413/com.firs.facedetecttosvr D/Face_Identify: DoTcpClient 45910-25 19:12:49.803 23377-23413/com.firs.facedetecttosvr D/Face_Identify: chksum[1439] recvSum[1439] DoTcpClient 46710-25 19:12:49.803 23377-23413/com.firs.facedetecttosvr D/Face_Identify: InStrProPack.csuffix[7f]10-25 19:12:49.803 23377-23413/com.firs.facedetecttosvr D/Face_Identify: recv InStrProPack->head.msgtype 256 InStrProPack->head.subType 2 AllDealTcp 68210-25 19:12:49.803 23377-23413/com.firs.facedetecttosvr D/Face_Identify: DealMsgAuth 14510-25 19:12:50.599 23377-23377/com.firs.facedetecttosvr I/Timeline: Timeline: Activity_launch_request time:2723482310-25 19:12:50.985 23377-23377/com.firs.facedetecttosvr D/Face_Identify: InitFaceLib()ghCe: 0xa9f539f0 fun:InitFacial line: 29210-25 19:12:51.029 23377-23377/com.firs.facedetecttosvr D/Face_Identify: fun:InitFacial line: 299 ghFacialCodec: 0xa9fba18010-25 19:12:51.029 23377-23377/com.firs.facedetecttosvr D/Face_Identify: DoTcpSendThreadPool Java_com_firs_cn_FaceNative_initFaceLib 35710-25 19:12:51.043 23377-23377/com.firs.facedetecttosvr D/ActivityThreadInjector: clearCachedDrawables.10-25 19:12:51.377 23377-23416/com.firs.facedetecttosvr V/RenderScript: 0xaeac8000 Launching thread(s), CPUs 410-25 19:12:51.613 23377-23450/com.firs.facedetecttosvr A/libc: Fatal signal 11 (SIGSEGV), code 2, fault addr 0xaebc4000 in tid 23450 (AsyncTask #1)
分析
关键代码:
@Override protected void onResume() { super.onResume(); //initCamera(); // 初始化摄像头得到width和height的值 surfaceCreated(surfaceHolder);//设置目标界面 //创建异步任务,必须传送非零的width和height mTask = new RecognizeTask(width, height, isFront);//异步操作 摄像头可用240 320 true mTask.setRecognizeListener(this);//重写接口方法 mTask.execute(0); }
我改动了一些java代码,导致出现了这个错误,我还原到改动之前的代码,一点一点去替换,发现是调用ndk时,传入的参数问题导致的,(上面代码的第4行,不应该注释掉,初始化摄像头得到width和height的值,在异步任务中调用jni方法会用到这两个值),但是不知道为什么会报出这个错误,想不出原因。感觉有点误导方向
解决方法:
@Override protected void onResume() { super.onResume(); initCamera(); // 初始化摄像头得到width和height的值 surfaceCreated(surfaceHolder);//设置目标界面 //创建异步任务,必须传送非零的width和height mTask = new RecognizeTask(width, height, isFront);//异步操作 摄像头可用240 320 true mTask.setRecognizeListener(this);//重写接口方法 mTask.execute(0); }
虽然示例很有针对性,但是不影响这种解决方法的普遍性,可以当做一种排查方案
0 0
- libxx.so has text relocations. This is wasting memory and prevents security hardening. Please fix
- .so has text relocations. This is wasting memory and prevents security hardening. Please fix.
- xxx.so has text relocations. This is wasting memory and is a security risk. Please fix
- xxx.so has text relocations. This is wasting memory and is a security risk. Please fix
- libxxx.so has text relocations. This is wasting memory and prevents...解决方案
- lib***.so: has text relocations
- xx.so: has text relocations
- libdvm.so has text relocations 错误
- android so一种异常: has text relocations
- So文件 has text relocations问题
- android 6.0 and sdk23, when used xx.so has text relocations.
- android 6.0 and sdk23, when used xx.so has text relocations. bug
- 调用so库时“xxx.so has text relocations”
- 调用.so 文件时报错has text relocations
- 调用.so 文件时报错has text relocations
- Android 6.0 crash - liblicensing.so: has text relocations
- 调用.so 文件时报错has text relocations(转载)
- 加载xxx.so 库时报 has text relocations
- 1036 商务旅行
- hdu 1036 (水题控制输入输出格式)
- Java8 Lambda表达式 ,此时不用,更待何时?
- 第八周OJ3求值
- Auto Control 000 自动控制原理 为什么要学
- .so has text relocations. This is wasting memory and prevents security hardening. Please fix.
- POJ 2153 Rank List(map)
- Node.js在windows下的安装
- 基于边界值分析方法选择测试用例的原则
- Apple公司Darwin流式服务器源代码分析(四)
- 用python代码实现文件的拷贝
- NOIP2015day2 跳石子
- poj Sudoku
- 1017. Queueing at Bank (25)