Horatio Chien
2018-09-12 09:10:43 UTC
I am developing a 64-bit, API 27, Qt-based vendor app.
This app won't be installed by "adb install" but by copying to
/vendor/app/<MyQtApp>.
I am getting a dlopen failed problem as following.
01-01 01:01:36.908 4190 4190 D QtJAVA : Try to load
/vendor/app/MyQtApp/plugins/platforms/android/libqtforandroid.so
01-01 01:01:36.908 4190 4190 D linker :
dlopen(name="/vendor/app/MyQtApp/plugins/platforms/android/libqtforandroid.so",
flags=0x2, extinfo=[flags=0x200, reserved_addr=0x356,
reserved_size=0x7fcd34dd40, relro_fd=-1739459248, library_fd=125,
library_fd_offset=0x7fcd34dd00,
library_namespace=classloader-***@0x7e1db0d210],
caller="/system/lib64/libnativeloader.so",
caller_ns=(default)@0x7e1dc443e0) ...
01-01 01:01:36.910 4190 4190 D linker : ... dlopen failed: library
"libQt5Gui.so" not found
01-01 01:01:36.910 4190 4190 D linker : dlerror set to "dlopen failed:
library "libQt5Gui.so" not found"
01-01 01:01:36.911 4190 4190 E QtJAVA : UnsatisfiedLinkError
'/vendor/app/MyQtApp/plugins/platforms/android/libqtforandroid.so'
01-01 01:01:36.911 4190 4190 E QtJAVA : java.lang.UnsatisfiedLinkError:
dlopen failed: library "libQt5Gui.so" not found
Before this exception, I had:
01-01 01:01:36.869 4190 4190 D QtJAVA : Try to load
/system/priv-app/MyQtApp/lib/arm64/libQt5Gui.so
01-01 01:01:36.869 4190 4190 D linker :
dlopen(name="/system/priv-app/MyQtApp/lib/arm64/libQt5Gui.so", flags=0x2,
extinfo=[flags=0x200, reserved_addr=0x356, reserved_size=0x7fcd34dd40,
relro_fd=-1739459248, library_fd=125, library_fd_offset=0x7fcd34dd00,
library_namespace=classloader-***@0x7e1db0d210],
caller="/system/lib64/libnativeloader.so",
caller_ns=(default)@0x7e1dc443e0) ...
01-01 01:01:36.870 4190 4190 D linker : ... dlopen calling constructors:
realpath="/vendor/app/MyQtApp/lib/arm64/libQt5Gui.so",
soname="libQt5Gui.so", handle=0x65acb23b20126b7f
01-01 01:01:36.870 4190 4190 D linker : ... dlopen successful:
realpath="/vendor/app/MyQtApp/lib/arm64/libQt5Gui.so",
soname="libQt5Gui.so", handle=0x65acb23b20126b7f
01-01 01:01:36.870 4190 4190 D linker :
dlsym(handle=0x65acb23b20126b7f("/vendor/app/MyQtApp/lib/arm64/libQt5Gui.so"),
sym_name="JNI_OnLoad", sym_ver="(null)", caller="/system/lib64/libart.so",
caller_ns=(default)@0x7e1dc443e0) ...
01-01 01:01:36.870 4190 4190 D linker : ... dlsym successful:
sym_name="JNI_OnLoad", sym_ver="(null)", found in="libQt5Core.so",
address=0x7d7c686c78
01-01 01:01:36.870 4190 4190 I QtJAVA : Successfully loaded
/system/priv-app/MyQtApp/lib/arm64/libQt5Gui.so
*Note that there is a
symlink /system/priv-app/MyQtApp -> /vendor/app/MyQtApp*
The files actually resides in /vendor/app/MyQtApp/, i.e. they are:
/vendor/app/MyQtApp/lib/arm64/libQt5Gui.so
/vendor/app/MyQtApp/plugins/platforms/android/libqtforandroid.so
My Java code:
Log.d(QtTAG, "Try to load " + libName); // libName shall be an absolute path
File f = new File(libName);
if (f.exists() && f.isFile() && f.canRead()) {
System.load(libName);
Log.i(QtTAG, "Successfully loaded " + libName);
}
The info. of libqtforandroid.so:
$ aarch64-linux-android-readelf.exe -d libqtforandroid.so
Dynamic section at offset 0x102df8 contains 37 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libjnigraphics.so]
0x0000000000000001 (NEEDED) Shared library: [libandroid.so]
0x0000000000000001 (NEEDED) Shared library: [libc++_shared.so]
0x0000000000000001 (NEEDED) Shared library: [liblog.so]
0x0000000000000001 (NEEDED) Shared library: [libz.so]
0x0000000000000001 (NEEDED) Shared library: [libm.so]
0x0000000000000001 (NEEDED) Shared library: [libdl.so]
0x0000000000000001 (NEEDED) Shared library: [libc.so]
0x0000000000000001 (NEEDED) Shared library: [libEGL.so]
0x0000000000000001 (NEEDED) Shared library: [libQt5Gui.so]
0x0000000000000001 (NEEDED) Shared library: [libQt5Core.so]
0x0000000000000001 (NEEDED) Shared library: [libGLESv2.so]
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so]
0x000000000000000e (SONAME) Library soname: [libqtforandroid.so]
0x000000000000000f (RPATH) Library rpath: [$ORIGIN/../../../lib]
It has a rpath and it indeed depends on libQt5Gui.so.
P.S.
nativeLibraryDir of ApplicationInfo is: /system/priv-app/MyQtApp/lib/arm64
My questions:
1. Why does linker want to load libQt5Gui.so again when libQt5Gui.so has
been loaded (in the same for loop)?
2. Why does linker fail to load libQt5Gui.so when loading
libqtforandroid.so?
Thank you.
--
The above code is in Java but debugging dlopen seems very ndk-related. I
hope I can put this post here.
This app won't be installed by "adb install" but by copying to
/vendor/app/<MyQtApp>.
I am getting a dlopen failed problem as following.
01-01 01:01:36.908 4190 4190 D QtJAVA : Try to load
/vendor/app/MyQtApp/plugins/platforms/android/libqtforandroid.so
01-01 01:01:36.908 4190 4190 D linker :
dlopen(name="/vendor/app/MyQtApp/plugins/platforms/android/libqtforandroid.so",
flags=0x2, extinfo=[flags=0x200, reserved_addr=0x356,
reserved_size=0x7fcd34dd40, relro_fd=-1739459248, library_fd=125,
library_fd_offset=0x7fcd34dd00,
library_namespace=classloader-***@0x7e1db0d210],
caller="/system/lib64/libnativeloader.so",
caller_ns=(default)@0x7e1dc443e0) ...
01-01 01:01:36.910 4190 4190 D linker : ... dlopen failed: library
"libQt5Gui.so" not found
01-01 01:01:36.910 4190 4190 D linker : dlerror set to "dlopen failed:
library "libQt5Gui.so" not found"
01-01 01:01:36.911 4190 4190 E QtJAVA : UnsatisfiedLinkError
'/vendor/app/MyQtApp/plugins/platforms/android/libqtforandroid.so'
01-01 01:01:36.911 4190 4190 E QtJAVA : java.lang.UnsatisfiedLinkError:
dlopen failed: library "libQt5Gui.so" not found
Before this exception, I had:
01-01 01:01:36.869 4190 4190 D QtJAVA : Try to load
/system/priv-app/MyQtApp/lib/arm64/libQt5Gui.so
01-01 01:01:36.869 4190 4190 D linker :
dlopen(name="/system/priv-app/MyQtApp/lib/arm64/libQt5Gui.so", flags=0x2,
extinfo=[flags=0x200, reserved_addr=0x356, reserved_size=0x7fcd34dd40,
relro_fd=-1739459248, library_fd=125, library_fd_offset=0x7fcd34dd00,
library_namespace=classloader-***@0x7e1db0d210],
caller="/system/lib64/libnativeloader.so",
caller_ns=(default)@0x7e1dc443e0) ...
01-01 01:01:36.870 4190 4190 D linker : ... dlopen calling constructors:
realpath="/vendor/app/MyQtApp/lib/arm64/libQt5Gui.so",
soname="libQt5Gui.so", handle=0x65acb23b20126b7f
01-01 01:01:36.870 4190 4190 D linker : ... dlopen successful:
realpath="/vendor/app/MyQtApp/lib/arm64/libQt5Gui.so",
soname="libQt5Gui.so", handle=0x65acb23b20126b7f
01-01 01:01:36.870 4190 4190 D linker :
dlsym(handle=0x65acb23b20126b7f("/vendor/app/MyQtApp/lib/arm64/libQt5Gui.so"),
sym_name="JNI_OnLoad", sym_ver="(null)", caller="/system/lib64/libart.so",
caller_ns=(default)@0x7e1dc443e0) ...
01-01 01:01:36.870 4190 4190 D linker : ... dlsym successful:
sym_name="JNI_OnLoad", sym_ver="(null)", found in="libQt5Core.so",
address=0x7d7c686c78
01-01 01:01:36.870 4190 4190 I QtJAVA : Successfully loaded
/system/priv-app/MyQtApp/lib/arm64/libQt5Gui.so
*Note that there is a
symlink /system/priv-app/MyQtApp -> /vendor/app/MyQtApp*
The files actually resides in /vendor/app/MyQtApp/, i.e. they are:
/vendor/app/MyQtApp/lib/arm64/libQt5Gui.so
/vendor/app/MyQtApp/plugins/platforms/android/libqtforandroid.so
My Java code:
Log.d(QtTAG, "Try to load " + libName); // libName shall be an absolute path
File f = new File(libName);
if (f.exists() && f.isFile() && f.canRead()) {
System.load(libName);
Log.i(QtTAG, "Successfully loaded " + libName);
}
The info. of libqtforandroid.so:
$ aarch64-linux-android-readelf.exe -d libqtforandroid.so
Dynamic section at offset 0x102df8 contains 37 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libjnigraphics.so]
0x0000000000000001 (NEEDED) Shared library: [libandroid.so]
0x0000000000000001 (NEEDED) Shared library: [libc++_shared.so]
0x0000000000000001 (NEEDED) Shared library: [liblog.so]
0x0000000000000001 (NEEDED) Shared library: [libz.so]
0x0000000000000001 (NEEDED) Shared library: [libm.so]
0x0000000000000001 (NEEDED) Shared library: [libdl.so]
0x0000000000000001 (NEEDED) Shared library: [libc.so]
0x0000000000000001 (NEEDED) Shared library: [libEGL.so]
0x0000000000000001 (NEEDED) Shared library: [libQt5Gui.so]
0x0000000000000001 (NEEDED) Shared library: [libQt5Core.so]
0x0000000000000001 (NEEDED) Shared library: [libGLESv2.so]
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so]
0x000000000000000e (SONAME) Library soname: [libqtforandroid.so]
0x000000000000000f (RPATH) Library rpath: [$ORIGIN/../../../lib]
It has a rpath and it indeed depends on libQt5Gui.so.
P.S.
nativeLibraryDir of ApplicationInfo is: /system/priv-app/MyQtApp/lib/arm64
My questions:
1. Why does linker want to load libQt5Gui.so again when libQt5Gui.so has
been loaded (in the same for loop)?
2. Why does linker fail to load libQt5Gui.so when loading
libqtforandroid.so?
Thank you.
--
The above code is in Java but debugging dlopen seems very ndk-related. I
hope I can put this post here.
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+***@googlegroups.com.
To post to this group, send email to android-***@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/68b2936d-5d46-48ac-bdff-e0f95030f108%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+***@googlegroups.com.
To post to this group, send email to android-***@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/68b2936d-5d46-48ac-bdff-e0f95030f108%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.