Compiling Qt Mobility Apps for Symbian on Linux


We at Tourschall developing our Qt client for Maemo, MeeGo and Symbian and since compiling for Maemo and MeeGo works perfectly fine without Windows, we are not too keen on setting up another Windows machine only to build for Symbian. Unfortunately there is no official Symbian SDK for Linux. Fortunately an unofficial one exists!

So here I’ll show you how to set up a working cross compiler for compiling Symbian binaries on a Linux machine including Qt and Qt Mobility. This procedure was tested on Ubuntu 10.04 (Lucid) and Ubuntu 10.10 (Maverick).

We will install everything into your home directory, so you don’t even need root access to do this and this installation won’t affect the rest of your system.

Download SDK, Qt and Qt Mobility

Install some tools

First we need some tools and utils:

apt-get install git build-essential bison flex libssl-dev

Then get the latest gnupoc using git:

git clone git://github.com/mstorsjo/gnupoc-package.git

Install the SDK

The following commands need to be executed in the directory to which you downloaded everything. I’ll assume it’s ~/Downloads. Also I assume that you cloned gnupoc into ~/Downloads/gnupoc

Install Symbian SDK:

./gnupoc/sdks/install_gnupoc_s60_50 S60_5th_Edition_SDK_v1_0_en.zip ~/sdk

Install Open C++ Plugin:

./gnupoc/sdks/install_openc_175_s60 s60_open_c_cpp_plug_in_v1_7_en.zip ~/sdk

Compile and install the compiler:

./gnupoc/tools/install_csl_gcc \
gnu-csl-arm-2005Q1C-arm-none-symbianelf.src.tar.bz2 ~/csl-gcc

Install some additional gnupoc tools:

./gnupoc/tools/install_eka2_tools ~/csl-gcc

Install Qt 4.7.1

./gnupoc/sdks/install_qt_4.7.1 qt-symbian-opensource-4.7.1-s60.exe \
-qt ~/sdk/qt_4.7.1 -sdk ~/sdk

Install gnupoc wrapper scripts:

./gnupoc/sdks/install_wrapper ~/gnupoc

Add paths to .profile:

export PATH=$PATH:"$HOME/gnupoc":"$HOME/csl-gcc/bin":"$HOME/sdk/qt_4.7.1/bin"
export EPOCROOT="$HOME/sdk/"

Install Qt Mobility:

./gnupoc/sdks/install_qt_mobility qt-mobility-symbian-opensource-1.1.0.zip \
-qt ~/sdk/qt_4.7.1 -sdk ~/sdk -mobility ~/sdk/qtm_1.1

Now, please make sure that running “qmake” will run your Symbian qmake. You can check that by running “qmake -query“. If your native platform qmake is called, you might want to change the PATH or rename one of them. I’ll assume that “qmake” will run your newly installed Symbian qmake.

Congratulations, now compile your code

You now should have a fully functional working cross compiler for Symbian. To compile and package your code simply type:

qmake -spec symbian/linux-gcce
make
make sis

To set a default “-spec” parameter, add QMAKESPEC=”symbian/linux-gcce” to your .profile.

Some possible pitfalls

Here are some minor pitfalls you might encounter.

QtOpenGL

I had the problem that the linker always looked for QtOpenGL.dso which is not part of the Symbian SDK. To solve this, I added “QT_CONFIG -= opengl” to my .pro file.

Location capability

If the location capability gets removed from your package. Have a look at the script ~/sdk/qt_4.7.1/bin/patch_capabilities.pl. Around line 81 there is @capabilitiesToAllow. Add “Location” if not there yet.

References & Thanks

Thanks to Martin Storsjo, his contributors and the original authors for the gnupoc project. Without that we had nothing. Also thanks to a couple of blogs that wrote about this subject.

Last but not least, thanks for the great support on #qt-symbian. That was very helpful!