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



Search | Go
Wiki > Main > QtBuildEnvironment

Qt Build Environment

Currently there are two desktop tools in SVN that are based on the Qt4 framework. Qt4 is available for all major Operating Systems (Linux, Windows, MacOS X).

Setup on Windows (2000, XP, Vista, 7)

On Windows Qt itself support various compilers. We're only using the gcc compiler as provided by the MinGW project. You also need some additional tools that are standard on Unix systems.

Qt4

You need a Qt framework that is build with the MinGW gcc compiler and the used compiler. The easiest way is to install the Qt SDK which includes a pre-built Qt and the MinGW compiler. The SDK also includes the integrated development environment Qt Creator.

Note: The Qt SDK does not include libz in its MinGW installation. This is not a bug in the SDK because you can link libz implicitly, we want to link it explicitly though. You can simply add this by downloading the libz dll and dev packages from the MinGW website and extracting the archives into the MinGW installation.

MinGW

Note: The Qt SDK comes with MinGW bundled. If you installed the Qt SDK you don't need to install MinGW separately.

If you want to go the manual route you can also install MinGW yourself (follow the instructions on the MinGW website). You then can use the "Qt libraries" from the Qt website instead or get the source and build Qt yourself.

MSYS

Various Makefiles use Unix tools that are not present on Windows. The easiest way to get those is to install MSYS 1.0.11. Newer versions of MSYS don't come bundled as installer, but that version is sufficient. If you're installing MinGW yourself (i.e. you are not using the Qt SDK) install msys using mingw-get as described on the MinGW homepage.

Environment

Both MinGW and MSYS needs to be accessible from within the PATH environment variable. To do this you can
  • add the paths permanently to the PATH environment variable. Make sure both MSYS and MinGW are at the beginning of the PATH list.
    Note: This might override some Windows programs and cause issues with other programs.
  • manually set the PATH environment variable when starting the command line. This is as simple as typing set PATH=c:\MSYS\1.0\bin;c:\Qt\2010.04\mingw\bin;%PATH%.
  • create a cmd script that sets the environment variable and keeps a window open. You can then invoke this script instead of running cmd.exe for building.

Rockbox source code

Get the source code from SVN as described in UsingSVN.

Setup on Linux

Qt is part of all major Linux distributions. Install the developments tools (various distributions have package groups for that) and the Qt development package (you also need qmake which is part of Qt. Some distributions split it out into a separate package). Note: some distributions install the qmake binary as qmake-qt4.

Setup on Mac OS X

You need to install
  • XCode (available on the OS X installation disk and at the Apple website)
  • Qt itself. If you intend to build universal binaries you need the Carbon version of Qt. Installing the libraries version is sufficient for compiling.

Building Qt4

Note: you don't need to build Qt4 yourself if you installed the Qt SDK and don't want to build statically linked binaries.

To create binaries that are statically linked against Qt you need to rebuild Qt statically. A statically built Qt is used for building the binaries provided to avoid having to extract additional DLL files.

(add description how to build Qt statically here)

Building the programs

Currently the following desktop programs use the Qt framework:

Please refer to their respective wiki pages on additional or changed build steps. If you have the build environment set up and the environment variables set correctly building usually is as simple as the following:
  • open the command window with the correct environment set
  • change to the source folder
  • run qmake. If you don't have qmake in your path (which is the case if you installed the Qt SDK) invoke it with the complete path. I.e. c:\Qt\2010.04\qt\bin\qmake.exe.
  • run mingw32-make. This has to be in your PATH, as otherwise the system won't find the compiler as well. If it's not in your PATH you haven't set up the environment correctly.

Platform specifics

Windows

OS X

If you want to build universal binaries targeting OS X 10.4 and up (configured in the program project file) you need to use the correct QMAKESPEC. On 10.6 Qt defaults to building xcode project files targeting 10.5 and up. You can select the used makespec in two ways (you don't need this when using deploy.py as it's already included in that):
  1. set the environment variable QMAKESPEC to macx-g++40, i.e. run export QMAKESPEC=macx-g++40 before running qmake
  2. use the qmake command line option -spec, i.e. run qmake as qmake -spec macx-g++40.

Linux

You can add the (undocumented) option -config silent to the qmake run. This will make the compiler output much more silent, giving a better chance to spot compiler warnings. This is especially useful when developing.

Using deploy.py

deploy.py is a Python script to automate building and releasing the Qt based programs. To use it you need the followign:

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

Copyright © by the contributing authors.