Android application compiles on ndk15c but crashes after libc++_shared.so library not found error
-
Hello,
We are using Qt 5.12.1 commercial version and we succesfully build our application for Linux x86_64 and Windows x86.
I am trying to compile with following configuration and using android-g++ spec
... QMAKE_CXXFLAGS += -std=c++11 DEFINES += "_GLIBCXX_USE_CXX11_ABI=0" DEFINES += "APP_STL=c++_static" DEFINES += "ANDROID_STL=c++_static" DEFINES += "APP_LDFLAGS=-latomic" DEFINES += "APP_PLATFORM=android-21" QMAKE_LFLAGS += -static-libstdc++ -static-libgcc ...
I almost tried to compile our application with the following ndks and standalone toolchains on Android
- r10e
- r11c
- r12b
- r13b
- r14b
- r15c
- r16b
- r19c
but when I try to deploy my application it crashes after installing apk and gives the following error:
I/art (11850): Late-enabling -Xcheck:jni I/art (11850): Debugger is no longer active W/linker (11850): libgnustl_shared.so: unused DT entry: type 0x6ffffffe arg 0x47d58 W/linker (11850): libgnustl_shared.so: unused DT entry: type 0x6fffffff arg 0x2 I/Qt JAVA (11850): Can't find '/data/app/com.someapp.desktop-1/lib/arm/lib.so' W/linker (11850): libQt5Core.so: unused DT entry: type 0x6ffffffe arg 0x5ff20 W/linker (11850): libQt5Core.so: unused DT entry: type 0x6fffffff arg 0x3 E/art (11850): dlopen("/data/app/com.someapp.desktop-1/lib/arm/libQt5Core.so", RTLD_LAZY) failed: dlopen failed: library "libc++_shared.so" not found E/AndroidRuntime(11850): FATAL EXCEPTION: qtMainLoopThread E/AndroidRuntime(11850): Process: com.someapp.desktop, PID: 11850 E/AndroidRuntime(11850): java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found E/AndroidRuntime(11850): at java.lang.Runtime.load(Runtime.java:331) E/AndroidRuntime(11850): at java.lang.System.load(System.java:981) E/AndroidRuntime(11850): at org.qtproject.qt5.android.QtNative$2.run(QtNative.java:183) E/AndroidRuntime(11850): at org.qtproject.qt5.android.QtThread$2.run(QtThread.java:87) E/AndroidRuntime(11850): at org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61) E/AndroidRuntime(11850): at java.lang.Thread.run(Thread.java:818) I/Process (11850): Sending signal. PID: 11850 SIG: 9
Then I tried to manually add r10e gcc libc++_shared.so for anroidarm-eabi library to libs under android-build folder. Then I got the following error message:
dlopen failed: cannot locate symbol "__ndk15ctypeIcE2idE" referenced by "libQt5Core.so"
I also tried to remove c++_static configs from qmake but no chance.
What am I doing wrong? And which points I miss? I will be glad if I can solve this problem, I spend almost a week for the problem.
In addition to this, I was able to compile and run my application successfully with ndk-r10e and Qt 5.6.0 open source version.
P.S: I also checked the libQt5Core.so with readelf
Dynamic section at offset 0x3c2ee0 contains 31 entries: Etiket Tip İsim/Değer 0x00000003 (PLTGOT) 0x3dc3f8 0x00000002 (PLTRELSZ) 26656 (bytes) 0x00000017 (JMPREL) 0x69280 0x00000014 (PLTREL) REL 0x00000011 (REL) 0x5ff80 0x00000012 (RELSZ) 37632 (bytes) 0x00000013 (RELENT) 8 (bytes) 0x6ffffffa (RELCOUNT) 1997 0x00000006 (SYMTAB) 0x1f0 0x0000000b (SYMENT) 16 (bytes) 0x00000005 (STRTAB) 0x18c90 0x0000000a (STRSZ) 237153 (bytes) 0x00000004 (HASH) 0x52af4 0x00000001 (NEEDED) Paylaşımlı kitaplık: [libz.so] 0x00000001 (NEEDED) Paylaşımlı kitaplık: [libc++_shared.so] 0x00000001 (NEEDED) Paylaşımlı kitaplık: [liblog.so] 0x00000001 (NEEDED) Paylaşımlı kitaplık: [libm.so] 0x00000001 (NEEDED) Paylaşımlı kitaplık: [libdl.so] 0x00000001 (NEEDED) Paylaşımlı kitaplık: [libc.so] 0x00000001 (NEEDED) Paylaşımlı kitaplık: [libstdc++.so] 0x0000000e (SONAME) Kitaplık so_adı: [libQt5Core.so] 0x0000001a (FINI_ARRAY) 0x3bca00 0x0000001c (FINI_ARRAYSZ) 16 (bytes) 0x00000019 (INIT_ARRAY) 0x3c3ed4 0x0000001b (INIT_ARRAYSZ) 12 (bytes) 0x6ffffff0 (VERSYM) 0x5cdb0 0x6ffffffc (VERDEF) 0x5ff04 0x6ffffffd (VERDEFNUM) 1 0x6ffffffe (VERNEED) 0x5ff20 0x6fffffff (VERNEEDNUM) 3 0x00000000 (NULL) 0x0
Thanks
Regards
-
Hi @virtualint and welcome
for Qt 5.12 and newer, you'll have to use "the latest " ndk. But If I remember correctly from other users, the latest r19c (release candidate back than) did not work correctly with qt either.
I'm running
r18b
and that's been working for me since I switched to 5.12 -
Hello @J-Hilk,
Thank you very much.
I tried r19c but QtCreator was not able to run my application. It still gives libc++_shared.so not found error. After this I manually copied the libc++_shared.so (under r19c) to android-build libs folder. Now I can successfully run my application on android again.
Regards