[QBS] Support for Qt on Android
chgans at gna.org
Fri Sep 16 06:23:16 CEST 2016
On 16 September 2016 at 15:47, Ch'Gans <chgans at gna.org> wrote:
> On 16 September 2016 at 01:49, <salatix at web.de> wrote:
>> I am building on linux. I also tried setting up the toolchain with qbs-setup-toolchains but it would not
>> detect the android toolchain. So I tried to configure it in the qbs-config-ui but it didn't help either
>> because I still got the error of the missing armv5 profile (which does not make any sense to me
>> because I am using armv7...).
>> In Qt Creator the profile looks fine to me and the profile it refers to actually exists in $HOME/.config
>> /QtProject/qbs/ but as I soon as QtC tries to parse the qbs it is looking for an armv5 profile which
>> does not exist. The issue is similiar to one of the bugs Jake referred to https://bugreports.qt.io
>> Were you able to parse a qbs project with your profile for qt on Android?
>> Thanks for helping with my problem :)
> This is how far i manage to go:
> # After failing setting up the toolchain manually, i discovered a new
> qbs tool... ;)
> $ qbs-setup-android --ndk-dir /opt/android/android-ndk-r12b/ --sdk-dir
> /opt/android/android-sdk-linux/ android
> # Et voilà! (almost)
> $ qbs-setup-qt /opt/Qt/5.7/android_armv7/bin/qmake qt57-andgcc49_armv7
> Creating profile 'qt57-andgcc49_armv7'.
> WARNING: You need to set up toolchain information before you can use
> this Qt version for building. However, no toolchain profile was found.
> Either create one using qbs-setup-toolchains and set it as this
> profile's base profile or add the toolchain settings manually to this
> $ qbs config profiles.qt57-andgcc49_armv7.baseProfile android-armv7a
> # Cannot build my project, qbs tells me to set these up
> $ qbs config profiles.android.Android.ndk.toolchainVersion 4.9
> $ qbs config profiles.android.Android.ndk.hostArch linux-x86_64
> $ qbs config profiles.android.Android.ndk.toolchainVersionNumber 4.9
> At this stage, i can run qbs, but my build fails, due to some weird
> STL issues i am currently investigating... (can't find "algorithm"
> Qbs tries to build my code with
> which should be instead
> This is where the header is located, and this is where android-g++
> mkspec points to.
> I'm currently investigating the source of
> Just found a workaround, i'm pretty sure i should set that in my own
> qbs files, but will do for now
> $ qbs config profiles.android.Android.ndk.appStl gnustl_shared
> And now trying to solve another issue:
> arm-linux-androideabi-g++: error: unrecognized command line option
> Which is set in
> when abi is "armeabi-v7a", which is my case, ... weird!
This one is related to the new way (Qbs-1.6) of declaring linkerFlags,
I got a warning message about this:
WARNING: Enabling linker flags compatibility mode. cpp.linkerFlags and
cpp.platformLinkerFlags escaping is handled automatically beginning in
Qbs 1.6. When upgrading to Qbs 1.6, you should only pass raw linker
flags to these properties; do not escape them using -Wl or -Xlinker.
This allows Qbs to automatically supply the correct linker flags
regardless of whether the linker chosen is the compiler driver or
system linker (see the documentation for cpp.linkerMode for more
information). This message can be silenced by setting your Project's
minimumQbsVersion to 1.6 (and the new behavior will take effect).
My understanding is that the old behaviour is kept if i don't
explicitly require Qbs 1.6 (which is my case so far), yet
modules/Android/ndk/utils.js returns linker flags without the -Wl
prefix, which seems to cause troubles...
OK, I have now switched to minimumQbsVersion="1.6", and the error is gone.
BTW, why do i have to set minimumQbsVersion="1.6" in all my
sub-projects? I thought this was enough to set that up in the
So, FYI, I am now able to build my whole project for Android as
described above! \o/
I now have to work on deployment, and see if it runs!
> Will keep posted!
>>> Gesendet: Donnerstag, 15. September 2016 um 02:07 Uhr
>>> Von: "Chris Gagneraud" <chgans at googlemail.com>
>>> An: salatix at web.de
>>> Cc: "Jake Petroules" <Jake.Petroules at qt.io>, "qbs at qt-project.org" <qbs at qt-project.org>
>>> Betreff: Re: [QBS] Support for Qt on Android
>>> > QtCreator manage its own Qbs profiles, that you cannot (easily) re-use
>>> > "manually".
>>> > Have you try to run "qbs setup-toolchain" and see if it picks up the
>>> > android one?
>>> I've just tried here, after installing all Android, Java and Qt
>>> packages and selecting an android kit, QtC tells me:
>>> Cannot find the android build step.
>>> Error while building/deploying project XYZ (kit: Android for
>>> armeabi-v7a (GCC 4.9, Qt 5.7.0))
>>> When executing step "Deploy to Android device"
>>> Tools->Options->Qbs seems to be setup correctly
>>> (cpp.toolchainInstallPath/Prefix points to my Android NDK toolchain)
>>> I had a quick go at setting up the toolchain manually with
>>> qbs-setup-toolchain, but it refuses to detect the toolchain....
>>> Anyway, your problem seems to be different since your associated Qbs
>>> profile look corrupted/missing.
>>> Which platform are you building on?
>>> On Linux, QtC profiles are stored under $HOME/.config/QtProject/qtcreator/qbs
>>> Whereas your "regular" qbs profiles are stored under
More information about the Qbs