libgdal.so Android的错误:无法加载库" libgdal.so.1" [英] libgdal.so android error: could not load library "libgdal.so.1"

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

问题描述

我的问题是这样的:使用Android工具链(CC = i686的-Linux的Andr​​oid平台的GCC,CXX = i686的-Linux的Andr​​oid平台的C ++),产生以下输出库libgdal我已成功建立GDAL 1.10.1。一,libgdal.la,libgdal.lai,libgdal.so,libgdal.so.1,libgdal.so.1.17.1在输出文件夹的.libs(在下面我会打电话给这个文件夹$ GDAL_LIB_PATH)。

my problem is the following: I have succesfully built GDAL 1.10.1 using an Android toolchain (CC=i686-linux-android-gcc, CXX=i686-linux-android-c++) that produces the following output libraries libgdal.a, libgdal.la, libgdal.lai, libgdal.so, libgdal.so.1, libgdal.so.1.17.1 in the output folder .libs (in the following I'll call this folder $GDAL_LIB_PATH).

我想建立在Windows上使用Qt 5.4一个简单的Andr​​oid应用程序(用QPushButton名为TestAndroid一个简单的Widget应用)。如果我不使用GDAL一切工作正常,我能够在Android模拟器上运行我的应用程序的所有可用平台:X86,armeabi和armeabi-V7

I am trying to build a simple Android app (a simple widget application with a QPushButton named TestAndroid) using Qt 5.4 on Windows. If I don't use GDAL everything works fine and I am able to run my app on an Android emulator for all available platforms: x86, armeabi and armeabi-v7.

不过,如果我尝试使用GDAL(前只需在应用程序的初始化调用GDALAllRegister()),然后连接使用下列错误libgdal.so应用程序崩溃:

Nonetheless, if I try to use GDAL (ex. by simply calling GDALAllRegister() in the initialization of the app) and then linking to libgdal.so the application crashes with the following error:

E /艺术(1614):执行dlopen(/数据/应用/ org.qtproject.example.TestAndroid-1 / lib目录/ 86 / libTestAndroid.so,RTLD_LAZY)失败:执行dlopen失败:无法加载库libgdal .so.1需要通过libTestAndroid.so造成库libgdal.so.1找不到

E/art ( 1614): dlopen("/data/app/org.qtproject.example.TestAndroid-1/lib/x86/libTestAndroid.so", RTLD_LAZY) failed: dlopen failed: could not load library "libgdal.so.1" needed by "libTestAndroid.so"; caused by library "libgdal.so.1" not found

我已经验证了Android平台是正确的(86),否则连接器将跳过错误的libgdal.so对象。

I have verified that the Android platform is the right one (x86), otherwise the linker would skip the wrong libgdal.so object.

我一直在使用ANDROID_EXTRA_LIBS * = $ GDAL_LIB_PATH / libgdal.so libgdal.so在* .apk文件(由Qt的生成)包括在内。其他文件(libgdal.so.x.x)不能列入,因为Qt的prevents用同样的方式。

I have included libgdal.so in the *.apk (generated by Qt) using ANDROID_EXTRA_LIBS *= $GDAL_LIB_PATH/libgdal.so. The other files (libgdal.so.x.x) cannot be included in the same way since Qt prevents it.

为了避免动态链接我也试图以我的应用程序li​​bgdal.a但很多链接时出现错误(例如未定义引用'ATOF)链接

In order to avoid dynamic linking I have also tried to link my app with libgdal.a but many link-time errors appears (ex. undefined reference to 'atof')

我有搜索在网络上,但我还没有找到一个解决我的问题。

I have searched on the web but I have not found a solution to my problem.

我不受限使用动态链接的话,对任何的以下问题的解决方案是为我好:

I am not constrained to use dynamic linking so, a solution to any of the following problems is good for me:


  1. 有没有办法避免的libgdal.so.x.x文件的创建时建立GDAL?

  1. is there a way to avoid the creation of libgdal.so.x.x files when building GDAL?

有没有办法,包括在使用Qt生成的* ​​.apk文件libgdal.so.x.x文件?

is there a way to include libgdal.so.x.x files in the *.apk file generated by Qt?

我如何避免链接时错误链接的静态库libgdal.a什么时候?

how can I avoid link-time errors when linking the static library libgdal.a?

先谢谢您的任何答复!

推荐答案

在试验和错误(主要错误)几天我已经找到了解决我的问题。

After several days of trials and errors (mainly errors) I have found a solution to my problem.

我写它作为一个回答我的问题,以便它可能会有所帮助其他的人。

I'm writing it as an answer to my question so that it may be helpful to other ones.

问题是在GDAL的链路时间。简而言之:链接与链接到它(libgdal.so.1和libgdal.so)

The problem was during the link-time of GDAL. Briefly: the linker created the "real name" shared library libgdal.so.1.17.1 together with the links to it (libgdal.so.1 and libgdal.so).

有关强制链接某些原因(我忽略),以libgdal.so,为libgdal.so.1(这反过来,wuold搜索的libgdal.so.1.17.1)。链接器的搜索

For some reasons (which I ignore) forcing the link to libgdal.so, the linker searches for libgdal.so.1 (which, in turn, wuold have searched for libgdal.so.1.17.1).

这解决了我的问题,可以通过以下步骤总结解决方法:

The workaround that solved my problem can be summarized in the following steps:


  1. 在GDAL根,根据需要的配置运行的./configure(见 http://trac.osgeo.org/gdal/wiki/BuildingForAndroid )检查的libtool是启用

  1. In the GDAL root, run the ./configure according to the desired configuration (see http://trac.osgeo.org/gdal/wiki/BuildingForAndroid) checking that libtool is ENABLED

编辑创建的libtool文件,如下所示(如用gedit克):

edit the created libtool file (e. g. with gedit) as follows:


  • 替换值 library_names_spec library_names_spec =\\ $ LIBNAME \\ $ {} shared_ext

  • 替换值 soname_spec soname_spec =

  • replace the value of library_names_spec with library_names_spec="\$libname\${shared_ext}"
  • replace the value of soname_spec with soname_spec=""

输入make

在输出文件夹中的.libs /只libgdal.so将被创建,现在链接libgdal.so似乎很好地工作。

In the output folder .libs/ the only libgdal.so will be created and now the link to libgdal.so seems to work fine.

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

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