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 patch_capabilities.pl
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: http://www3.symbian.com/faq.nsf/0/B8542F039C193CCC802573DA0011DFA7
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://gitorious.org/qt/qt.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 \
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)
- 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.
# 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
- Install ARM toolchain:
mkdir -p $TOOLCHAIN_DIR
tar -C $TOOLCHAIN_DIR -xvjf \
- Unpack gnupoc sources and apply the patch that adds Qt for S60 support:
tar -xvzf $SRC_DIR/gnupoc-package-1.13.tar.gz
patch -p1 -i $SRC_DIR/qt_s60_gnupoc_v4.patch
- Install gnupoc:
- Install gnupoc wrappers and native tools:
sed -i "s,EKA2TOOLS=.*,EKA2TOOLS=$TOOLCHAIN_DIR/bin," \
- Install OpenC (now necessary even for 5.0 SDK):
chmod +x install_openc_16_s60
- Add support for RVCT to the SDK:
chmod +x install_rvct_support
- Create a “gnupoc_env.sh” script to be used for gnupoc environment setup, by running this command:
cat > gnupoc_env.sh << EOF
export EPOCROOT=$S60_SDK_DIR/ # trailing "/" is required!
(Note: the “cat << EOF … EOF” snippet above will generate a “gnupoc_env.sh” file in $GNUPOC_ROOT.)
- Unset all temporary variables we used earlier:
unset TOOLCHAIN_DIR S60_SDK_DIR WRAPPER_DIR SRC_DIR
(Note: GNUPOC_ROOT is not unset because it will be used later on when creating the environment script for Qt.)
- Finally, initialize environment by running:
(Note the “.” (dot) before gnupoc_env.sh. This command will run the commands listed in gnupoc_env.sh 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 autogen.sh script.
- Compile configure.bin:
- Configure Qt sources:
-platform linux-g++ \
-xplatform symbian-abld \
- Compile Qt:
- Create a “qt_s60_env.sh” script to be used for Qt/S60 environment setup, by running this command:
cat > $GNUPOC_ROOT/qt_s60_env.sh << EOF
(Note: the “cat << EOF … EOF” snippet above will generate a “qt_s60_env.sh” file in $GNUPOC_ROOT.)
- Finally, initialize environment by running:
(Note the “.” (dot) before qt_s60_env.sh. This command will run the commands listed in qt_s60_env.sh 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 “patch_capabilities.pl” 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/patch_capabilities.pl \
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:
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:
Now create a “main.cpp” file with the following code:
int main(int argc, char *argv)
QApplication app(argc, argv);
QPushButton hello("Hello, World!");
Create the .pro file by running:
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
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