[QBS] Support for Qt on Android

Ch'Gans chgans at gna.org
Fri Sep 16 05:47:31 CEST 2016


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
> /browse/QBS-881.
>
> 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
profile.

$ 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"
header)
Qbs tries to build my code with
"-isystem/opt/android/android-ndk-r12b/sources/cxx-stl/system/include",
which should be instead
"-isystem/opt/android/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/"
This is where the header is located, and this is where android-g++
mkspec points to.
I'm currently investigating the source of
/opt/Qt/Tools/QtCreator/share/qtcreator/qbs/share/qbs/modules/cpp/android-gcc.qbs

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
'--fix-cortex-a8'

Which is set in
/opt/Qt/Tools/QtCreator/share/qtcreator/qbs/share/qbs/modules/Android/ndk/utils.js
when abi is "armeabi-v7a", which is my case, ... weird!

Will keep posted!

Chris

>
>
>> 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?
>> >
>> >Chris
>> 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
>> $HOME/.config/QtProject/qbs/
>>
>> Chris
>
>>



More information about the Qbs mailing list