[Qbs] "qbs setup-qt" and Qt built for cross-compilation

Christian Kandeler christian.kandeler at qt.io
Thu Jan 4 12:00:31 CET 2018


On Thu, 4 Jan 2018 10:55:33 +0100
Ola Røer Thorsen <ola at silentwings.no> wrote:

> I'm building an application on a linux host computer for a target
> imx6-based device. I built the Qt version myself configured for
> cross-compilation. So far I've only used qbs via QtCreator and the kits
> configured there, and this works fine.

The same messages probably appear there as well, on the console you started Creator from.

> When using cross-compilation, the host tools such as qmake are separated
> from the installed Qt headers and libraries that are installed into the
> target device's sysroot.
> 
> /hostqt contains the host tools
> /targetsysroot is the root of the target sysroot, in my case i've got Qt
> installed in
> /targetsysroot/opt/qt
> 
> I'll have to build from a build server as well, and now I tried running qbs
> from the command line, setting up the qt version I'm using using "qbs
> setup-qt". I got some warnings from it, is this a bug or can it be ignored?

Depends. It means that qbs modules for these Qt modules are not created, so you will not be able to do this in your products:

Depends { name: "Qt.bootstrap" }
Depends { name: "Qt.qmldevtools" }

The first one you should never need to do. I don't know what the qmldevtools library is for.

> Seems like setup-qt is expecting to find the Qt libraries in the path
> relative to where qmake is installed.

What makes you think that? The output you quoted does not suggest it.
The libraries, along with their prl files, are looked up in the value qmake -query gives you for
QT_INSTALL_LIBS (more or less, the real code takes care of some special cases). The list of libraries should correspond to a subset of the files in mkspecs/modules/qt_lib*.pri.

> qbs setup-qt /hostqt/bin/qmake crossprofile
> 
> gives
> 
> Creating profile 'crossprofile'.
> Skipping prl file '/targetsysroot/opt/qt/lib/libQt5QmlDevTools.prl',
> because it cannot be opened (No such file or directory).
> Skipping prl file '/targetsysroot/opt/qt/lib/libQt5Bootstrap.prl', because
> it cannot be opened (No such file or directory).

Only for these two files?

> The files that qbs is looking for here are not in the target rootfs, but
> rather in
> 
> /hostqt/lib

These are probably for the host version of the respective library. Look for the associated .a files in the same directory and check their architecture. It should be x64 or whatever your host machine is.
I suppose the prl files in the sysroot are simply missing, for reasons I don't know. Do the following files exist?
/targetsysroot/opt/qt/lib/libQt5QmlDevTools.a
/targetsysroot/opt/qt/lib/libQt5Bootstrap.a

> Would qbs have been able to figure out the toolchain if the files were
> found properly? 

No, you need to run qbs-setup-toolchains beforehand for your target compiler (or afterwards and set the baseProfile manually). Note that setup-qt does not extract compiler flags from mkspecs, so you might need to fine-tune the toolchain profile afterwards if the respective mkspec contains custom flags for that target (you did not seem to have problems building with Creator, so the defaults seem to be more or less ok, but there might be subtle differences).

> Building using this qmake binary creates proper makefiles
> for cross compilation without any further configuration necessary, so the
> information IS there somewhere.

I don't really know what qmake does with prl files, if anything.


Christian



More information about the Qbs mailing list