无法加载库"libdl.so.2". [英] could not load library "libdl.so.2"

查看:1734
本文介绍了无法加载库"libdl.so.2".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试将linux编译的预建共享库与我的android jni应用程序一起使用,但是当我尝试运行该应用程序时,出现以下错误:

I have been trying to use linux compiled prebuilt shared library with my android jni application, but when i try to run the application it gives following error:

04-16 19:09:13.633:E/dalvikvm(11810):dlopen("/data/app-lib/com.lXXXX.XXXX.connect-2/libXXX_embedded_shared.so")失败:无法加载库: soinfo_link_image(linker.cpp:1636):无法加载"libXXX_embedded_shared.so"所需的库"libdl.so.2" ;由load_library(linker.cpp:746)引起:找不到库"libdl.so.2"

04-16 19:09:13.633: E/dalvikvm(11810): dlopen("/data/app-lib/com.lXXXX.XXXX.connect-2/libXXX_embedded_shared.so") failed: Cannot load library: soinfo_link_image(linker.cpp:1636): could not load library "libdl.so.2" needed by "libXXX_embedded_shared.so"; caused by load_library(linker.cpp:746): library "libdl.so.2" not found

我在android/system/lib中找不到libdl.so.2,但是有一个库libdl.so,我尝试加载该库,但仍然无法解决依赖关系.

i could not find libdl.so.2 in android/system/lib but there is a library libdl.so which i tried to load but it still did not resolve the dependency.

能给我指出我在这里想念的吗?

Can you please point me what i am missing here?

推荐答案

您不能执行此操作.

Android和普通的linux具有很大的用户空间,特别是它们使用完全不同的C库和关联的不兼容动态链接器.

Android and a normal linux have vastly different userspaces, in particular they use entirely different C libraries and associated incompatible dynamic linkers.

对版本库名称(.so.2-Android当前不执行的操作)的强烈渴望表明该库不是为Android构建的.

The very desire for a versioned library name (the .so.2 - something Android doesn't currently do) is indicative that this library was not build for Android.

您需要使用android ndk重建所有库,方法是创建Android.mk和类似文件以驱动正常的ndk构建系统,或者使用ndk实用程序生成支架"单独的工具链",然后将项目的构建系统指向以android-targeted为目标的gcc,ld等.

You need to rebuild all your libraries using the android ndk either by creating and Android.mk and similar files to drive the normal ndk build system, or by using the ndk utility for generating a "stand alone toolchain" and pointing your project's build system at the resulting android-targeted gcc, ld, etc.

有些人通过在chroot中放置一小部分debian-arm或类似的东西,从而设法在root用户的设备上使用了普通的linux userspace组件,但这需要root用户进行设置,并且jni无法从应用程序进程进行链接反正.您的应用程序流程已经与Android的C库紧密相关,因此您无法真正替代另一个.

Some people have managed to use normal linux userspace components on rooted devices by putting a whole minimal install of debian-arm or similar in a chroot, but that requires root to set up and would not be linkable from an application process by jni anyway. Your application process is already deeply tied to Android's C library so you can't really substitute another.

这篇关于无法加载库"libdl.so.2".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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