Cross compiling Qt for the masses

Published Friday April 13th, 2012 | by

Cross compiling Qt for particular devices/BSPs can be frustrating when operating from first principles and we are trying to improve the existing configure/qmake build infrastructure in Qt 5, as well as the associated documentation, in order to ease this burden. We are approaching the problem from 2 angles:

  • General cross compilation support
  • Direct target support

The general cross compilation support is being improved by:

  • Reworking the pkg-config logic
  • Introducing the -device flag to configure
  • Introducing the -sysroot flag to configure

The supported targets are documented here:

http://wiki.qt-project.org/Devices

and as you can see in the Raspberry Pi documentation, we have reduced compilation for this target down to:

./configure -prefix <your prefix> -release
  -device linux-rasp-pi-g++ -make libs
  -device-option CROSS_COMPILE=<your toolchain path>/bin/arm-none-linux-gnueabi-
  -sysroot <your sysroot path>

The resulting build has full (single process) OpenGL ES 2 support and keyboard support for the Raspberry Pi.

There is no need to patch any files as all the relevant changes have been upstreamed into Qt 5 where they can be adequately reviewed and QAed like any other Qt contribution. Needless to say this drastically increases the quality of the code finding its way on to these devices and should drastically improve the user experience when dealing with this kind of hardware for prototyping/productization/recreation. Sunlight is the best disinfectant, and we delight in consuming this dog food.

We heartily invite any (all!) chipset vendors/chipset customers/BSP vendors or interested parties to upstream relevant mkspecs and the associated code changes to Qt, in order to extend the breadth of Qt 5′s out-of-the-box device support. The move to Open Governance has made extending this support increasingly achievable, feasible and convenient and we are very excited about both Qt 5 as a whole and the current rate of development towards embedded (read constrained) Linux platforms.

Did you like this? Share it:
Bookmark and Share

Posted in Contributors, Embedded, Open Governance, Qt

13 comments to Cross compiling Qt for the masses

Baso says:

Hi all,

The great keywords == Performance, Speed, Enhancement

Hope we see Qt5 run always as native on supported OS’s regarding that keywords. We have no doubt that Qt has ability to bring code for our applications to be cross platform in a great way, but we cannot let ourselves to stay here a long time without continuing to inject more such great keywords into Qt to push it forward every time.

We put our programming life on Qt and we have decided to invest on it and will not give up as long as Qt gives us what we need and allow us to compete other native applications (not cross ones) while we sit on cross platform chair!.

Thanks to Qt’s team, supporters, developers, users

linnaus says:

good news

zhxt says:

Very exciting! This new way makes it easier to port Qt for embedded system. Well done! Guys.

Kromain says:

Hey Donald,

Cool stuff! And you should be seeing some gerrit entries soon to add support for the Archos tablets :)

Nokiar says:

Chipset vendor? Intel?arm?samsung? They are not so friendly as you think. It’s all about business, all about money and market share. Do you have any common profit with them?

Qt5Guru says:

@nokiar: looking at the qt5 repo, there’s already mkspecs for broadcom, amlogic, trident and ST boards.

Donald says:

@Nokiar:

We have long standing relationships with all the companies you mention. All of these companies have general Linux centric programmes for various products falling in a range of areas and price points. Qt still dominates the embedded Linux landscape for general purpose devices and all of these groups would benefit by extending their Qt competence into actual contribution and active participation in Qt (5) development.

Common profit: A highly performant technically advanced developer friendly broadly utilized/tested, permissively licensed toolkit

Felix says:

Will this make crosscompiling for Windows easier?

Donald says:

@Felix: No, not really

Cross compiling for windows should simply be a mkspec/configure related task. This device functionality adds in device specific OS, hardware and initialization quirks.

Please note I have never tried generating Windows binaries from within Linux, so I have no clue how complex/convoluted this process is.

Baso says:

@Felix:

I have done and compiled three buisness applications using Qt 4.x on windows xp sp3 without any headache at all and all the three applications were at the expectations of customers. I used Qwidgets and c++ to create them and more then that I run the compiled versions on windows 7 32/64bits without problems. I used Qt creator and qmake for coding and compiling.

Donald says:

@Baso:

I believe @Felix is talking about cross compilation for Windows from Linux:

https://fedoraproject.org/wiki/Features/Windows_cross_compiler

Fedora toted it as one of their features a couple releases ago, and all this kind of support would require is an adequate mkspec, not this device support.

@Baso: I am also glad Qt meets your needs and brings home the bacon :)

Baso says:

@Donald:

Thanks for that, at a moment of time I realized that I did a mistake by not understanding the content of @Felix’s message but I preferred my response to be useful for someone else !

It was so important to write a right answer for him, but I have no way since I don’t use Linux for developing Qt app.

@Donald: I am so happy with Qt framework and all of its features. I’m ready to take part of making it spreaded in my region as I think I’m the only one who uses Qt for building applications as far as I know. Another important thing is before Qt I was using another products for building app. but after using Qt I think my programming life has changed for the better.

Donald says:

KDAB (Consultancy partner) have not only be instrumental hoisting the RIM port, but have also just given us additional device mkspecs for Linux on a couple devices:

https://codereview.qt-project.org/#change,24428,patchset=2

These specs all clearly need to be maintained by someone to ensure they are sound and guaranteed to work. If you submit them, expect to own them :)

Commenting closed.