release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide
translations



Search | Go
Wiki > Main > QtFramework

Qt Framework


Description

Qt is a cross-platform C++ framework for creating applications. Originally a GUI framework it also supports console only applications. Qt is developed by Nokia. See also Wikipedia on more details about Qt.

Qt is used for some PC-based tools for Rockbox:

Building Qt

Unless you want to compile a statically linked application it's usually not necessary to compile Qt yourself. Nokia provides binary packages for Windows and OS X, and Linux distributions have packages as well.

Compiling statically linked executable has advantages for deployment. Especially there is no need to distribute the DLLs for Qt anymore. For this reason we use a statically built Qt for building RockboxUtility and the ThemeEditor. To do so compiling Qt itself is necessary.

All Platforms

Building Qt can take quite a while, especially since it does build a lot of examples and demos by default. To cut down the build time you can pass the initial configure call some options to disable various features.
  • -nomake demos: Disable demos (recommended)
  • -nomake examples: Disable examples (recommended)
  • -nomake docs: Disable documentation if you don't want to have it locally (or have another Qt installation on the machine already)
  • -fast: don't create Makefiles for demos and examples, useful if you don't build them (speeds up configure run)
  • -no-webkit: Disable Webkit. Webkit isn't currently needed by and of our applications and takes a long time to build.
  • -release: build release library only. If you don't plan debugging with the built library using this is a good idea.

You need to pass the following option to configure:
  • -static: build static binary. This is required, otherwise you'll get a library for dynamic linking (and in that case you don't need to build yourself, see above).

Windows

On Windows the MinGW toolchain is used to build both Qt and applications. Qt itself also supports Microsoft Visual Studio but this isn't supported with our applications.

Native

Install MinGW using mingw-get.

Configure and build Qt. We usually use the following for configuring Qt: configure -no-exceptions -static -release -no-webkit -no-dbus -no-phonon -no-phonon-backend -no-qt3support -no-opengl -no-direct3d -no-style-motif -no-style-cde

Cross compiling from Linux / OS X

For cross compiling you can use the MinGW cross compiling environment to set up everything. Install dependencies from the MacPorts project (cmake, scons, xz). The lrelease binary isn't added add cross tool (which is unnecessary since it's platform independent). At least Rockbox Utility's project file tries to use that from the Qt installation. Therefore you need to create a symbolic link to the native lrelease in the mingw-cross-env installation folder below usr/i686-pc-ming32/bin.

Linux

There's nothing special to care about. If you want to get rid of dependencies to other libraries like libpng make sure there are static libs in the compilers search path.

Mac OS X

OS X uses Application Bundles which also include dynamic binaries. Therefore building Qt statically on OS X is unnecessary. Just use the binary packages provided by Nokia. Use the Carbon package to still include support for OS X 10.4.

Important: When building Qt applications make sure to used the correct compiler as otherwise strange errors occur. OS X 10.6 defaults to gcc-4.2 which doesn't support the OS X 10.4 SDK anymore. In order to be able to build Qt applications that still support OS X 10.4 you need to use gcc-4.0 (part of XCode 3.2). To do so pass qmake the correct spec either by setting the environment variable QMAKSPEC=macx-g++40 or via the command line option -spec, i.e. qmake -spec macx-g++40.

r2 - 02 Apr 2021 - 20:46:07 - UnknownUser

Copyright © by the contributing authors.