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.
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:
- S60_5th_Edition_SDK_v1_0_en.zip (623MB): S60 Platform SDK for Symbian OS, for C++ (5th Edition)
- s60_open_c_cpp_plug_in_v1_6_en.zip (35MB): Open C/C++ Plugin
- gnu-csl-arm-2005Q1C-arm-none-symbianelf-i686-pc-linux-gnu.tar.bz2 (11MB): CodeSourcery’s ARM toolchain for Symbian
- gnupoc-package-1.13.tar.gz (6.2MB): scripts and patches to run S60 SDK on Linux
- qt_s60_gnupoc_v4.patch (40KB): gnupoc fixes/extensions for supporting Qt for S60 builds (4th version of the patch)
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:
- 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:
ARM/Thumb C/C++ Compiler, RVCT2.2 [Build 686]
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.
- Install ARM toolchain:
- Unpack gnupoc sources and apply the patch that adds Qt for S60 support:
- Install gnupoc:
- Install gnupoc wrappers and native tools:
- Install OpenC (now necessary even for 5.0 SDK):
- Add support for RVCT to the SDK:
- Create a “gnupoc_env.sh” script to be used for gnupoc environment setup, by running this command:
- Unset all temporary variables we used earlier:
- Finally, initialize environment by running:
# 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
mkdir -p $TOOLCHAIN_DIR
tar -C $TOOLCHAIN_DIR -xvjf \
tar -xvzf $SRC_DIR/gnupoc-package-1.13.tar.gz
patch -p1 -i $SRC_DIR/qt_s60_gnupoc_v4.patch
sed -i "s,EKA2TOOLS=.*,EKA2TOOLS=$TOOLCHAIN_DIR/bin," \
chmod +x install_openc_16_s60
chmod +x install_rvct_support
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 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.)
(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:
- Compile Qt:
- Create a “qt_s60_env.sh” script to be used for Qt/S60 environment setup, by running this command:
- Finally, initialize environment by running:
-platform linux-g++ \
-xplatform symbian-abld \
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.)
(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