Compiling Qt for S60 (from GIT) on Linux

Update (2009-09-06): Add instructions for generating the .sis file
Update (2009-09-16): Rebase GIT clone against 4.6 branch; update gnupoc patch (V3); add instructions for
Update (2009-09-17): A few textual fixes; fixes added to the GIT tree; new gnupoc patch (V4); added instructions for testing the built Qt
Update (2009-09-18): fix GIT instructions
Update (2009-09-21): Use RVCT 2.2 (build 686); small changes to the hello example

Currently it is only possible to build Qt for S60 on Windows and using the proprietary RVCT compiler from ARM.

Windows is needed because the Symbian support code contains calls to the Win32 API, Windows style paths (using backslashes), a few calls to .bat and .exe tools, and inconsistent case for path names (a real issue for Unix based systems).

RVCT is needed due to limitations in GCCE (the GCC Symbian port). From the Qt/S60 README:

The current version of GCCE cannot compile the Qt libraries themselves as it has issues with global static data in DLLs. […]. For more information on this issue see:

Thanks to the community effort around the gnupoc project (and further modifications made by Martin Storsjö for supporting the newer S60 SDK releases) we are able to build regular S60 applications on Linux. To allow also building Qt applications for S60, it was necessary to port the Symbian support from Qt sources to Linux, and a few more changes to the Symbian SDK scripts to improve Linux support.

You will find below instructions for building Qt for S60 on Linux, using sources from GIT, plus the Linux host support from my own clone.

The RVCT requirement is still necessary, but fortunately there is a Linux version of RVCT available on ARM site (it is paid, but there is a 30-day evaluation version).


Although I had previously blogged about installing the S60 SDK on Linux together with the Qt 4.5.2 “tower” release, I will again describe the installation instructions here. Even if you have the S60 SDK already installed, you will need to install it again. This is necessary because gnupoc needs more fixes for building Qt.

That said, download the necessary files:

For building the native tools from gnupoc, you will need:

  • the GCC C/C++ compilers
  • development files for zlib
  • development files for openssl

On Ubuntu, you can install these using the following command:
sudo apt-get install build-essential zlib1g-dev libssl-dev

For building Qt itself, you will also need:

  • RVCT 2.2 (build 686) for Linux installed and accessible on PATH. Run armcc --vsn and you should see:
  • ARM/Thumb C/C++ Compiler, RVCT2.2 [Build 686]

  • WINE. A few tools from S60 SDK (elftran, genstubs and getexports) are only available for Windows. Fortunately, recent versions of WINE are able to run these tools just fine.
  • A copy of Qt GIT tree containing support for Linux host from my tree clone. If you do not have Qt GIT tree downloaded, you get it by running:
  • git clone git://
    Next, add a remote for my clone and create a local “s60_linux” branch that will be used to track changes for Linux host support:
    git remote add -f -t s60_linux \
      qt_s60_linux git://
    git checkout -b s60_linux qt_s60_linux/s60_linux

    If at some point you need to update the tree (and don’t have any local changes), you can run:
    git checkout s60_linux
    git fetch qt_s60_linux
    git reset --hard qt_s60_linux/s60_linux

S60 SDK Installation (5.0 only)

  1. First, set some environment variables to be used on the following steps (feel free to modify them to install the SDK on some other location). NOTE: these variables are not necessary after installation.
  2. # root directory where all SDK files will be installed
    # toolchain directory
    # S60 SDK directory
    # wrapper directory (used by gnupoc)
    # where all downloaded files are located

  3. Install ARM toolchain:
  4. mkdir -p $TOOLCHAIN_DIR
    tar -C $TOOLCHAIN_DIR -xvjf \

  5. Unpack gnupoc sources and apply the patch that adds Qt for S60 support:
  6. tar -xvzf $SRC_DIR/gnupoc-package-1.13.tar.gz
    cd gnupoc-package-1.13
    patch -p1 -i $SRC_DIR/qt_s60_gnupoc_v4.patch

  7. Install gnupoc:
  8. cd sdks
    ./install_gnupoc_s60_50 \
      $SRC_DIR/ \

  9. Install gnupoc wrappers and native tools:
  10. ./install_wrapper $WRAPPER_DIR
    cd ../tools
    ./install_eka2_tools $TOOLCHAIN_DIR
    sed -i "s,EKA2TOOLS=.*,EKA2TOOLS=$TOOLCHAIN_DIR/bin," \

  11. Install OpenC (now necessary even for 5.0 SDK):
  12. cd ../sdks
    chmod +x install_openc_16_s60
    ./install_openc_16_s60 \
      $SRC_DIR/ \

  13. Add support for RVCT to the SDK:
  14. chmod +x install_rvct_support
    ./install_rvct_support $S60_SDK_DIR

  15. Create a “” script to be used for gnupoc environment setup, by running this command:
  16. cd $GNUPOC_ROOT
    cat > << EOF
    export EPOCROOT=$S60_SDK_DIR/ # trailing "/" is required!

    (Note: the “cat << EOF … EOF” snippet above will generate a “” file in $GNUPOC_ROOT.)

  17. Unset all temporary variables we used earlier:
    (Note: GNUPOC_ROOT is not unset because it will be used later on when creating the environment script for Qt.)

  19. Finally, initialize environment by running:
  20. .
    (Note the “.” (dot) before This command will run the commands listed in on the current shell session, as if you typed them by hand.)

Building Qt for S60

The current configure shell script used for Linux builds does not contain a full support for Symbian. Therefore the configure.exe source was ported to Linux. Here it is called “configure.bin”, and is generated by the script.

  1. Compile configure.bin:
  2. ./

  3. Configure Qt sources:
  4. ./configure.bin \
      -opensource \
      -confirm-license \
      -platform linux-g++ \
      -xplatform symbian-abld \
      -no-webkit \

  5. Compile Qt:
  6. make release-armv5

  7. Create a “” script to be used for Qt/S60 environment setup, by running this command:
  8. cat > $GNUPOC_ROOT/ << EOF
    export PATH=$PWD/bin:\$PATH
    export QMAKESPEC=symbian-abld

    (Note: the “cat << EOF … EOF” snippet above will generate a “” file in $GNUPOC_ROOT.)

  9. Finally, initialize environment by running:
  10. . $GNUPOC_ROOT/
    (Note the “.” (dot) before This command will run the commands listed in on the current shell session, as if you typed them by hand.)

Reducing Symbian capabilities for Qt

By default, Qt for S60 requires high Symbian capabilities. It does not use all those capabilities itself, but this is done so that the generated SIS does not limit capabilities for Qt applications that need them. Unless you have access to certificates that can sign with high capabilities, you will need to “patch” the generated binaries so that it only requests the set of capabilities accessible through Open Signed Online or by using self-signed certificates.

Fortunately, there is a script under Qt sources called “” that does just that. I also modified it so that it “patches” the Secure ID and UID3 to match the range used for development purposes (see this page for more details about Symbian UIDs). To be able to self-sign the generated .sis for Qt, run this command:

perl ./bin/ \
  src/s60installs/Qt_for_S60_template.pkg \

Note this must be done AFTER building Qt, because it modifies some files generated by the build.

Creating the SIS file

To create the final .sis file for Qt, run this command:

make -C src/s60installs/ sis

You should see output similar to:

Processing qt_for_s60_release-armv5.pkg...
Created qt_for_s60_release-armv5_unsigned.sis
Successfully created qt_for_s60_release-armv5.sis using certificate Self Signed!

You will find the generated qt_for_s60_release-armv5.sis under “src/s60installs/”.

Testing the built Qt: hello world!

The Qt source has many examples and demos, but a simple “hello world” is very suitable for checking whether Qt was built correctly and if the environment is properly setup.

First, set the environment for gnupoc and Qt/S60, unless you already run these commands on the current terminal session:


Next, create a directory that will contain the hello project:

mkdir hello
cd hello

Now create a “main.cpp” file with the following code:

#include <QtGui>
int main(int argc, char *argv[])
    QApplication app(argc, argv);
    QPushButton hello("Hello, World!");
    QObject::connect(&hello, SIGNAL(clicked()),
        &app, SLOT(quit()));;
    return app.exec();

Create the .pro file by running:

qmake -project

Now create the Makefile (and a couple of S60 specific files):


Finally, build the project and generate a (self-signed) SIS file for it:

make release-gcce # or release-armv5, if using RVCT
make sis

The SIS file will be created on the current directory with the name “<project>_release-<platform>.sis”, where <project> is the project name and <platform> is the S60 platform (either gcce or armv5).


  • Test the compiled Qt on the device

About lizardo

My hobby: figure out how systems are expected to work; induce them to work unexpectedly; and responsibly disclose.
This entry was posted in General and tagged , , , . Bookmark the permalink.

3 Responses to Compiling Qt for S60 (from GIT) on Linux

  1. Pingback: How to Troubleshoot Linux Error 'cannot execute “/etc/init.d/boot'? Data Recovery on

  2. Jason Barron says:

    Great article! One minor correction though 😉 Qt does not require TCB capabilities. In fact, for most applications you can probably get by with the set of capabilities granted by self-signing. This is suitable for most of the examples shipped with Qt.

    Even if you want to make an application that requires more than the basic capabilities, you pretty much never need TCB unless you are a device manufacturer 🙂

    • lizardo says:

      Good to know! Actually it was just “rumors” that I heard… I’ll update the article accordingly.

      I did not try yet the built libraries because I didn’t know how to create the .sis file (unlike the examples, where I can simply do “qmake && make release-armv5 && makesis .pkg”)… but it seems that I just need to:

      cd src/s60installs
      make sisx

      Is that correct? Anyway, I still have some bug fixes to do and some rearrangement to the tree before requesting a merge.

      Thanks for the feedback!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s