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
).
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
.
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/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
I have verified that the Android platform is the right one (x86), otherwise the linker would skip the wrong libgdal.so
object.
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.
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:
Is there a way to avoid the creation of
libgdal.so.x.x
files when building GDAL ?Is there a way to include
libgdal.so.x.x
files in the*.apk
file generated by Qt ?How can I avoid link-time errors when linking the static library
libgdal.a
?
Thanks in advance for any reply!