Android的NDK的UnsatisfiedLinkError:"执行dlopen失败:空/缺少DT_HAS​​H" [英] Android NDK UnsatisfiedLinkError: "dlopen failed: empty/missing DT_HASH"

查看:1895
本文介绍了Android的NDK的UnsatisfiedLinkError:"执行dlopen失败:空/缺少DT_HAS​​H"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我追查崩溃,我们的Andr​​oid应用程序(它使用NDK加载一个C ++库)使用崩溃报告服务。用户少数遇到下列崩溃:

  java.lang.UnsatisfiedLinkError中:执行dlopen失败:(?建有--hash式= GNU)空/在cpplibrary.so失踪DT_HAS​​H
   在java.lang.Runtime.loadLibrary(Runtime.java:365)
   在java.lang.System.loadLibrary(System.java:526)

这对夫妻的提到了这个错误,我可以在互联网上找到(例如本的谷歌网上论坛帖子​​)商讨建库,导致每一个应用程序运行时发生此错误的问题。有关于为什么会发生零星的资料很少。 <一href=\"http://stackoverflow.com/questions/10645249/intermittent-android-ndk-unsatisfiedlinkerror\">This后是我能找到的最接近。

基于坠毁痕迹

,它看起来像任何特定用户会经常遇到这种绵延的;我不知道,如果这些用户永远能够正确地加载库。有没有人有什么可能导致这种情况只是偶尔发生的想法?我可以做的NDK建立不同的尝试,并阻止它?

谢谢!

编辑:<一href=\"http://stackoverflow.com/questions/17818058/android-ndk-unsatisfiedlinkerror-a-surprising-reason\">This帖子提到两种方式来获得有条件这样的错误;我会在寻找他们。

EDIT2:构建文件:
Android.mk(节选):

 包含$(CLEAR_VARS)
LOCAL_EXPORT_C_INCLUDES:= $(LOCAL_PATH)
LOCAL_C_INCLUDES:=&lt;信源路径&GT; ...
LOCAL_CFLAGS:= -DANDROID -Wall
LOCAL_CPPFLAGS:= -DENABLE_SDK_DEBUGGING = 1 -DENABLE_SDK_LOGGING = 1
LOCAL_MODULE:= cpplibrary
LOCAL_SRC_FILES:=&lt;信源文件&GT; / ...LOCAL_LDLIBS:= -llog -landroid
LOCAL_STATIC_LIBRARIES:= cpplibrary
包括$(BUILD_SHARED_LIBRARY)

Application.mk:

  APP_STL:= stlport_static
APP_CFLAGS + = -std = C ++ 11


解决方案

您正试图加载库是最有可能与 -Wl建, - 哈希风格= GNU 。这是不支持在Android直到最近(据我所知这是不是即使在L)。您需要使用 -Wl建立你的图书馆 - 哈希风格= SYSV

您是如何建立 cpplibrary.so ?如果你没有做任何事情来手动切换到GNU散列风格,也可能是在NDK的错误。

I am tracking down crashes with our Android application (which uses the NDK to load a C++ library) using a crash reporting service. A small number of users are experiencing the following crash:

java.lang.UnsatisfiedLinkError: dlopen failed: empty/missing DT_HASH in "cpplibrary.so" (built with --hash-style=gnu?)
   at java.lang.Runtime.loadLibrary(Runtime.java:365)
   at java.lang.System.loadLibrary(System.java:526)

The couple of mentions of this error I can find on the internet (for example this Google Groups post) discuss problems with building the libs, which cause this error to occur every time the app is run. There is little information on why this might happen sporadically. This post is the closest I can find.

Based on the crash traces, it looks like any particular user will experience this constantly for stretches; I am not sure if these users are ever able to load the lib correctly. Does anyone have ideas on what might cause this to happen only sometimes? Can I do the NDK build differently to try and stop it?

Thanks!

Edit: This post mentions two ways to get such errors conditionally; I will be looking in to them.

Edit2: Build files: Android.mk (excerpt):

include $(CLEAR_VARS)
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_C_INCLUDES := <Source Path>...
LOCAL_CFLAGS := -DANDROID -Wall
LOCAL_CPPFLAGS := -DENABLE_SDK_DEBUGGING=1 -DENABLE_SDK_LOGGING=1
LOCAL_MODULE := cpplibrary
LOCAL_SRC_FILES := <Source Files> / ...

LOCAL_LDLIBS    := -llog -landroid
LOCAL_STATIC_LIBRARIES := cpplibrary
include $(BUILD_SHARED_LIBRARY)

Application.mk:

APP_STL := stlport_static
APP_CFLAGS += -std=c++11

解决方案

The library you are trying to load was most likely built with -Wl,--hash-style=gnu. This was not supported on Android until recently (afaik this isn't even in L). You need to build your libraries with -Wl,--hash-style=sysv.

How did you build cpplibrary.so? If you didn't do anything to manually switch to the gnu hash style, it could be a bug in the NDK.

这篇关于Android的NDK的UnsatisfiedLinkError:&QUOT;执行dlopen失败:空/缺少DT_HAS​​H&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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