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:
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.
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
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.
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).
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.
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
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
in the mingw-cross-env installation folder below
There's nothing special to care about. If you want to get rid of dependencies to other libraries like
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.
When building Qt applications make sure to used the correct compiler as otherwise strange errors occur. OS X 10.6 defaults to
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
(part of XCode 3.2). To do so pass
the correct spec either by setting the environment variable
or via the command line option
qmake -spec macx-g++40
Copyright © by the contributing authors.