无法加载库“libdl.so.2"

could not load library quot;libdl.so.2quot;(无法加载库“libdl.so.2)

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

问题描述

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") 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

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?

解决方案

You cannot do this.

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

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.

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.

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"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:无法加载库“libdl.so.2"

基础教程推荐