[Qbs] Android: -target unknown option

Christian Gudrian qbs at gudrian.org
Thu Aug 1 10:45:35 CEST 2019


Hello!

I am trying to build a simple application for Android. Current setup:

- Qt 5.13.0 
- Qt Creator 4.9.2 (Qbs 1.13.1)
- Android SDK 26.1.1
- Android NDK 19.2.5345600 (in /opt/android-ndk-r19c)
- Android Target: 5.1 (API 22)
- macOS 10.14.6

Qt Creator gives me thumbs up for my Android Kit.

The first thing I noticed, that I need to explicitly set qbs.architecture (in my case „x86_64“) which otherwise would be undefined. Why isn’t that inferred from the selected kit?

Then Qbs tries to call the compiler „x86_64-linux-android-clang“ which doesn’t exist. Instead it is named „x86_64-linux-android22-clang“. Looking at android-gcc.qbs I can see no trace of the API level being used for constructing the compiler name. Has Google changed the naming convention?

So I created an appropriate symlink. Now Qbs resolves everything. And after setting Android.ndk.appStl to „c++_shared“ everything compiles (otherwise the STL headers cannot be found).

But now the linker bails out with

/opt/android-ndk-r19c/toolchains/llvm/prebuilt/darwin-x86_64/bin/../lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld: -target: unknown option

caused by Qbs adding „-target,x86_64-linux-android“ to cpp.platformLinkerFlags in the auto-generated profile and I don’t know how to get rid of that.

Is there something fundamentally wrong with my setup?

Christian


More information about the Qbs mailing list