[Android-development] Has anybody managed to get a Qt app built with clang/libc++ running on Android?

BogDan bog_dan_ro at yahoo.com
Thu Mar 15 07:34:28 CET 2018


Hi,

Back when I added android-clang support I used NDK r14 or NDK r15 (I don't remember the exact version) and it worked ok. Be aware that you must build all your libs with the same kit, otherwise you'll get problems at runtime (e.g. will use gnustl instead of clang's libc++).

The main problem is that Google (Android folks) always finds a way to break the compatibility almost every time when they release a new SDK/NDK. It's in their nature, I can bet you that they hired people just to screw things up and make sure that they pissed us from time to time. Working with their tools is a leaving hell, QtCreator folks can tell you more on this matter.
Of course, after they worked so hard to build their reputation, NDK r16 was not an exception.

I'm not saying that we are some innocent angels, some problems might be on our side, but I don't feel like investing time to fix the problems with NDKr16 and start again when they will ship the next NDK. E.g.  https://bugreports.qt.io/browse/QTBUG-64654 looks like it's our fault and we should fix it, but even with that fix, QtDecarative still refuses to run properly when it's compiled with clang and unified headers (I tested dev branch a few days ago).

My suggestion is to stick with NDK r10e for a while. It's stable, and it just works.

If NDK folks will stop breaking things each version, we'll consider to make android-clang the default* one for Android in Qt 5.12, but personally I'll not hold my breath for such a miracle.


Yours,
BogDan.

*now that latest and greatest clang produce just ~5% larger bins than the old and faithful gcc 4.9.




On Thursday, March 15, 2018, 7:25:26 AM GMT+2, Лагнер, Сергей <developer at lagner.ru> wrote: 





Hello.

Stacktrace with addresses does not provide a lot of usefull information.
There is a tool in android ndk called ndk-stack
Run
> $ANDROID_NDK/ndk-stack -sym /path/to/unstripped/libraries -dump /file/with/dump

You will get the function names that is much more readable

2018-03-15 4:46 GMT+07:00 Aleix Pol <aleixpol at kde.org>:
> On Tue, Mar 13, 2018 at 4:39 PM,  <policeterror at dyne.org> wrote:
>> Hello,
>>
>> gnustl is deprecated in latest NDK and C++11 is not working. Since I have a
>> library dependency using C++11, I'm forced to upgrade to clang/libc++
>>
>> I've built Qt with clang/libc++, but I'm running into this error where my
>> program crashes on startup with "your application  encountered a fatal error
>> and cannot continue", and seeing this error in the application output:
>>
>> W System.err: Caused by: java.lang. UnsatisfiedLinkError: dlopen failed:
>> library "libgnustl_shared.so" not found
>>
>> I've filed a bug which has been upgraded to P2: Important
>>
>> https://bugreports.qt.io/ browse/QTBUG-67006
>>
>> Anybody have any solutions or workarounds for this?
> 
> Hi,
> I've been doing some research to use clang too, I've been having
> problems as well, not the UnsatisfiedLinkError though.
> 
> It seems to start and then it just crashes at some point.
> 
> 03-14 22:44:07.897  7476  7476 F DEBUG   : *** *** *** *** *** *** ***
> *** *** *** *** *** *** *** *** ***
> 03-14 22:44:07.897  7476  7476 F DEBUG   : Build fingerprint:
> 'google/angler/angler:8.1.0/ OPM3.171019.016/4565142:user/ release-keys'
> 03-14 22:44:07.897  7476  7476 F DEBUG   : Revision: '0'
> 03-14 22:44:07.897  7476  7476 F DEBUG   : ABI: 'arm'
> 03-14 22:44:07.897  7476  7476 F DEBUG   : pid: 7454, tid: 7473, name:
> QtMainThread  >>> org.qtproject.example.gallery <<<
> 03-14 22:44:07.897  7476  7476 F DEBUG   : signal 31 (SIGSYS), code 1
> (SYS_SECCOMP), fault addr --------
> 03-14 22:44:07.897  7476  7476 F DEBUG   : Cause: seccomp prevented
> call to disallowed arm system call 397
> 03-14 22:44:07.897  7476  7476 F DEBUG   :     r0 ffffff9c  r1
> dc994c10  r2 00000000  r3 00000fff
> 03-14 22:44:07.897  7476  7476 F DEBUG   :     r4 cc9ff188  r5
> cc9ff2a8  r6 cdb6a697  r7 0000018d
> 03-14 22:44:07.897  7476  7476 F DEBUG   :     r8 cc9ff180  r9
> df2a8fc4  sl cc9ff2ec  fp cc9ff2e8
> 03-14 22:44:07.897  7476  7476 F DEBUG   :     ip cc9ff158  sp
> cc9ff148  lr cdb6ba3d  pc e7df5ccc  cpsr 800e0010
> 03-14 22:44:07.900  7476  7476 F DEBUG   :
> 03-14 22:44:07.900  7476  7476 F DEBUG   : backtrace:
> 03-14 22:44:07.900  7476  7476 F DEBUG   :     #00 pc 00018ccc
> /system/lib/libc.so (syscall+32)
> 03-14 22:44:07.900  7476  7476 F DEBUG   :     #01 pc 00129a39
> /data/app/org.qtproject. example.gallery-1rIYj0- Nv14ywyCUed3rjg==/lib/arm/ libQt5Core.so
> 03-14 22:44:07.900  7476  7476 F DEBUG   :     #02 pc 00128693
> /data/app/org.qtproject. example.gallery-1rIYj0- Nv14ywyCUed3rjg==/lib/arm/ libQt5Core.so
> 03-14 22:44:07.900  7476  7476 F DEBUG   :     #03 pc 000fbc9f
> /data/app/org.qtproject. example.gallery-1rIYj0- Nv14ywyCUed3rjg==/lib/arm/ libQt5Core.so
> (QFileInfo::isFile() const+64)
> 03-14 22:44:07.900  7476  7476 F DEBUG   :     #04 pc 0010a2e5
> /data/app/org.qtproject. example.gallery-1rIYj0- Nv14ywyCUed3rjg==/lib/arm/ libQt5Core.so
> 03-14 22:44:07.900  7476  7476 F DEBUG   :     #05 pc 0010a261
> /data/app/org.qtproject. example.gallery-1rIYj0- Nv14ywyCUed3rjg==/lib/arm/ libQt5Core.so
> (QStandardPaths::locate( QStandardPaths:: StandardLocation, QString
> const&, QFlags<QStandardPaths:: LocateOption>)+80)
> 03-14 22:44:07.900  7476  7476 F DEBUG   :     #06 pc 00120f09
> /data/app/org.qtproject. example.gallery-1rIYj0- Nv14ywyCUed3rjg==/lib/arm/ libQt5Core.so
> 03-14 22:44:07.900  7476  7476 F DEBUG   :     #07 pc 00120bd7
> /data/app/org.qtproject. example.gallery-1rIYj0- Nv14ywyCUed3rjg==/lib/arm/ libQt5Core.so
> 03-14 22:44:07.900  7476  7476 F DEBUG   :     #08 pc 00121525
> /data/app/org.qtproject. example.gallery-1rIYj0- Nv14ywyCUed3rjg==/lib/arm/ libQt5Core.so
> 03-14 22:44:07.900  7476  7476 F DEBUG   :     #09 pc 001587d5
> /data/app/org.qtproject. example.gallery-1rIYj0- Nv14ywyCUed3rjg==/lib/arm/ libQt5Core.so
> (QCoreApplicationPrivate:: init()+104)
> 03-14 22:44:07.900  7476  7476 F DEBUG   :     #10 pc 000c6a83
> /data/app/org.qtproject. example.gallery-1rIYj0- Nv14ywyCUed3rjg==/lib/arm/ libQt5Gui.so
> (QGuiApplicationPrivate::init( )+26)
> 
> Will replicate this on the bug report as well.
> Aleix
> ______________________________ _________________
> Android-development mailing list
> Android-development at qt- project.org
> http://lists.qt-project.org/ mailman/listinfo/android- development
> 

_______________________________________________
Android-development mailing list
Android-development at qt-project.org
http://lists.qt-project.org/mailman/listinfo/android-development



More information about the Android-development mailing list