Installing Qt for S60 daily snapshots on Linux September 24, 2009
Posted by lizardo in General.Tags: Linux, qt, S60, symbian
comments closed
Update (2009-09-24): Add workaround for GCCE issue.
Update (2009-10-05): Update gnupoc patch to apply against 20091005 snapshot. Remove workarounds from “Known Issues” sections that are already integrated into new patch.
Update (2009-10-07): Add instruction for installing gnupoc build dependencies.
Update (2009-10-23): New patch version (v9), that now applies cleanly to latest snapshots.
In a previous post, I provided instructions on running Qt for S60 SDK (the “Tower” release) on Linux. However, for those who want to play with the bleeding edge Qt for S60 development, you might want to try out the latest 4.6 development code from Qt GIT. I put some instructions for compiling Qt for S60 from GIT on Linux as well, but unfortunately it requires the RVCT compiler to build.
Fortunately, today espenr announced daily snapshots, that will allow those who don’t have access to RVCT to try out the latest 4.6 development as well
. So how to get this thing running on Linux? The snapshots so far consist only of the Windows installer and a .zip containing the source code.
By “merging” information from my two previous posts, I will describe below how to install the Qt for S60 SDK daily snapshots on Linux. Even if you have a previous installation of the Symbian SDK, you will need to follow the full instructions again (sorry), as these instructions contain a bunch of bug fixes to the Symbian SDK. Hopefully this requirement will go away at some point, when all Symbian SDK portability issues are addressed.
These instructions were tested only in the following environment:
- Host: x86 32-bits (running Ubuntu 8.10)
- Device and SDK: S60 5.0 (N97 and 5800)
Preparation
Download all required files:
- S60_5th_Edition_SDK_v1_0_en.zip (623MB): S60 Platform SDK for Symbian OS, for C++
- s60_open_c_cpp_plug_in_v1_6_en.zip (35MB): Open C/C++ Plugin
- qt-embedded-s60-opensourceYYYYMMDD-4.6.0-tp1.exe: Qt for S60 latest daily snapshot (you need only the .exe for running the SDK). Last tested version: 2009-10-05
- 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_v9.patch: patch for gnupoc, adding support for Qt for S60 installation and various bug fixes
(many thanks to Francisco Keppler for hosting this last file on his web site!)
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
Installation
- 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 Symbian S60 SDK:
- Install gnupoc wrappers and native tools:
- Create a “gnupoc_env.sh” script to be used for gnupoc environment setup, by running this command:
- Initialize the S60 SDK environment (you will need to do this every time you close the current shell session):
- Install OpenC:
- Install Qt for S60 (it will take some time because some tools need to be compiled for Linux):
- Create a “qt_s60_env.sh” script to be used for Qt/S60 environment setup, by running this command:
- Initialize the Qt for S60 environment (you will need to do this every time you close the current shell session):
- Install the following SIS files on your device:
- $EPOCROOT/nokia_plugin/openc/s60opencsis/pips_s60_1_6_ss.sis
- $EPOCROOT/nokia_plugin/openc/s60opencsis/openc_ssl_s60_1_6_ss.sis
- $EPOCROOT/nokia_plugin/opencpp/s60opencppsis/stdcpp_s60_1_6_ss.sis
- $QT_S60_DIR/qt_for_s60_selfsigned.sis
- Unset all temporary variables we used earlier:
# root directory where all SDK files will be installed
GNUPOC_ROOT=$HOME/gnupoc
# toolchain directory
TOOLCHAIN_DIR=$GNUPOC_ROOT/csl_gcc
# S60 SDK directory
S60_SDK_DIR=$GNUPOC_ROOT/symbian-sdks/5.0
# Qt SDK directory
QT_S60_DIR=$GNUPOC_ROOT/qt_s60
# wrapper directory (used by gnupoc)
WRAPPER_DIR=$GNUPOC_ROOT/bin
# where all downloaded files are located
SRC_DIR=$HOME/downloads
mkdir -p $TOOLCHAIN_DIR
tar -C $TOOLCHAIN_DIR -xvjf \
$SRC_DIR/gnu-csl-arm-2005Q1C-arm-none-symbianelf-i686-pc-linux-gnu.tar.bz2
tar -xvzf $SRC_DIR/gnupoc-package-1.13.tar.gz
cd gnupoc-package-1.13
patch -p1 -i $SRC_DIR/qt_s60_gnupoc_v8.patch
cd sdks
./install_gnupoc_s60_50 \
$SRC_DIR/S60_5th_Edition_SDK_v1_0_en.zip \
$S60_SDK_DIR
./install_wrapper $WRAPPER_DIR
cd ../tools
./install_eka2_tools $TOOLCHAIN_DIR
# adjust EKA2TOOLS variable to point to correct location
sed -i "s,EKA2TOOLS=.*,EKA2TOOLS=$TOOLCHAIN_DIR/bin," \
$WRAPPER_DIR/gnupoc-common.sh
cat > $GNUPOC_ROOT/gnupoc_env.sh << EOF
export PATH=$WRAPPER_DIR:\$PATH
export EPOCROOT=$S60_SDK_DIR/ # trailing "/" is required!
EOF
(Note: the “cat << EOF … EOF” snippet above will generate a “gnupoc_env.sh” file in $GNUPOC_ROOT.)
. $GNUPOC_ROOT/gnupoc_env.sh
cd ../sdks
chmod +x install_openc_16_s60
./install_openc_16_s60 \
$SRC_DIR/s60_open_c_cpp_plug_in_v1_6_en.zip \
$S60_SDK_DIR
chmod +x install_qt_s60
./install_qt_s60 \
$SRC_DIR/qt-symbian-opensource-4.6.0-snapshot-YYYYMMDD.exe \
$S60_SDK_DIR \
$QT_S60_DIR
If installation went well, you should see the following:
...
Qt is now configured for building. To start the build run:make debug-winscw|debug-armv5|release-armv5.
To reconfigure, run 'make confclean' and configure.
Of course, you do not want to build Qt, so just ignore it and proceed with the next step.
cat > $GNUPOC_ROOT/qt_s60_env.sh << EOF
export PATH=$QT_S60_DIR/bin:\$PATH
export QMAKESPEC=symbian-abld
EOF
(Note: the “cat << EOF … EOF” snippet above will generate a “qt_s60_env.sh” file in $GNUPOC_ROOT.)
. $GNUPOC_ROOT/qt_s60_env.sh
unset GNUPOC_ROOT TOOLCHAIN_DIR S60_SDK_DIR \
QT_S60_DIR WRAPPER_DIR SRC_DIR
Usage
You need to setup the environment, so tools like qmake, bldmake, abld, makesis etc. are found (not necessary if you just did the installation, unless you closed the shell session):
. /path/to/gnupoc_env.sh
. /path/to/qt_s60_env.sh
Note the “.” (dot) before the gnupoc_env.sh. It says that the contents of the gnupoc_env.sh file will be run in the current shell session, as if you typed them by hand.
To actually build some Qt code, use these commands:
cd path/to/source
qmake # assuming the code already has a .pro file
make debug-gcce # or make debug-armv5 (if using RVCT)
make sis # to generate .sis file
And to clean the source:
make distclean
Notes:
- Be sure to use qmake from Qt/S60. Otherwise the generated Makefiles will be for your host system
- The trailing slash on the EPOCROOT variable is important (this is assumed in many places on Symbian SDK scripts)
Known Issues
- The snapshots contain only the the “debug” libraries. Therefore, only the debug targets will work, i.e. use only “make debug-gcce” (if using GCCE compiler) or “make debug-armv5″ (if using RVCT)
See also the more general known issues related to Qt for S60.
Ideas for improvements
Some ideas:
- Create a nice GUI installer for Linux
- Allow to easily upgrade Qt for S60 SDK installation, without requiring to reinstall the entire Symbian SDK
- Itegration with Qt Creator, KDevelop or some other IDE
Feel free to contribute with your ideas or even better, help implementing them
Compiling Qt for S60 (from GIT) on Linux September 5, 2009
Posted by lizardo in General.Tags: Linux, qt, S60, symbian
comments closed
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).
Preparation
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 \
qt_s60_linux git://gitorious.org/~lizardo/qt/lizardos-qts60.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)
- 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
GNUPOC_ROOT=$HOME/gnupoc
# toolchain directory
TOOLCHAIN_DIR=$GNUPOC_ROOT/csl_gcc
# S60 SDK directory
S60_SDK_DIR=$GNUPOC_ROOT/symbian-sdks/5.0
# wrapper directory (used by gnupoc)
WRAPPER_DIR=$GNUPOC_ROOT/bin
# where all downloaded files are located
SRC_DIR=$HOME/downloads
mkdir -p $TOOLCHAIN_DIR
tar -C $TOOLCHAIN_DIR -xvjf \
$SRC_DIR/gnu-csl-arm-2005Q1C-arm-none-symbianelf-i686-pc-linux-gnu.tar.bz2
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
cd sdks
./install_gnupoc_s60_50 \
$SRC_DIR/S60_5th_Edition_SDK_v1_0_en.zip \
$S60_SDK_DIR
./install_wrapper $WRAPPER_DIR
cd ../tools
./install_eka2_tools $TOOLCHAIN_DIR
sed -i "s,EKA2TOOLS=.*,EKA2TOOLS=$TOOLCHAIN_DIR/bin," \
$WRAPPER_DIR/gnupoc-common.sh
cd ../sdks
chmod +x install_openc_16_s60
./install_openc_16_s60 \
$SRC_DIR/s60_open_c_cpp_plug_in_v1_6_en.zip \
$S60_SDK_DIR
chmod +x install_rvct_support
./install_rvct_support $S60_SDK_DIR
cd $GNUPOC_ROOT
cat > gnupoc_env.sh << EOF
export PATH=$WRAPPER_DIR:\$PATH
export EPOCROOT=$S60_SDK_DIR/ # trailing "/" is required!
EOF
(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.)
. gnupoc_env.sh
(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:
./autogen.sh
./configure.bin \
-opensource \
-confirm-license \
-platform linux-g++ \
-xplatform symbian-abld \
-no-webkit \
-no-phonon
make release-armv5
cat > $GNUPOC_ROOT/qt_s60_env.sh << EOF
export PATH=$PWD/bin:\$PATH
export QMAKESPEC=symbian-abld
EOF
(Note: the “cat << EOF … EOF” snippet above will generate a “qt_s60_env.sh” file in $GNUPOC_ROOT.)
. $GNUPOC_ROOT/qt_s60_env.sh
(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 \
src/s60installs/Qt_for_S60_template.pkg \
release-armv5
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:
. $GNUPOC_ROOT/gnupoc_env.sh
. $GNUPOC_ROOT/qt_s60_env.sh
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()));
hello.show();
return app.exec();
}
Create the .pro file by running:
qmake -project
Now create the Makefile (and a couple of S60 specific files):
qmake
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).
TODO
- Test the compiled Qt on the device
PySide released! August 18, 2009
Posted by lizardo in General.Tags: pyside, python, qt
comments closed
From the original announcement:
PySide is a project providing an LGPL’d set of Python bindings for the Qt framework.
PySide already provides a full set of Qt bindings as well as automated binding generation tools. Since the whole toolset has been made available, the team expects PySide to be valuable not only to Qt software developers, but to people willing to create Python bindings to any Qt-based library, or to any C++ library in general. Although based on a different technical approach, PySide will initially be API-compatible with existing Python bindings for Qt.
PySide is still a work in progress, and some work is still required to stabilize the codebase. This being said, the team believes it is already in a usable state, especially if an occasional rough edge and unpainted surface can be tolerated. Due to practical reasons, the initial development efforts have been focused on Linux, but the team hopes people to join in porting the code to other platforms and to further develop the bindings and tools.
So if you are interested in creating Python bindings for Qt based C++ code or (soon) other generic C++ code, feel free to try out PySide tools and contribute to its development
.
Running Qt for S60 SDK on Linux July 29, 2009
Posted by lizardo in General.Tags: Linux, qt, S60, symbian
comments closed
Update (2009-08-04): fixed qt_s60_gnupoc.patch (thanks grego), plus a few text additions.
Update (2009-08-21): update instructions to support S60 5.0 too.
A while ago I started playing with S60 programming. After downloading rather big SDK files and following instructions from http://www.martin.st/symbian/, I was able to build simple “hello world” applications written in C++, on Linux.
Then I remembered reading about an experimental Qt port to S60. I wanted to try it, given that I also began playing with Qt a while ago. To my surprise, I could not find any actual instructions on how to do that on Linux, although I found a few requests for it in comments from Qt Labs blog posts.
So, without further delay, I describe below the steps I followed to build Qt applications for S60 devices on Linux. These instructions are provided as an extension to those on Martin’s page, so be sure to read it too. But given that some patches are needed on top of Martin’s tools, I will show the full instructions here.
Note: these instructions were tested only in the following environment:
- x86 32-bits
- Ubuntu 8.04
- S60 3.1 (N95) and S60 5.0 (5800 Xpress Music)
I tried making it work for my 3.0 MR based device, but it seems that I need to recompile all Qt using the proprietary ARM RVCT compiler. If someday I make it work, I’ll post instructions for it too.
Preparation
Download all required files:
- S60-SDK-200634-3.1-Cpp-f.1090b.zip (355MB) or S60_5th_Edition_SDK_v1_0_en.zip (623MB): S60 Platform SDK for Symbian OS, for C++
- OpenC-1.5.5b-beta.zip (29MB): Open C/C++ Plug-ins for S60 3rd Edition (already present on S60 5.0 SDK, only needed for 3.1)
- qt-embedded-s60-preview-4.5.2-tower.exe (127MB): Qt for S60 “Tower” pre-release
- 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.patch (12KB): patch for gnupoc to also support Qt S60 installation
- qt-s60-extra-files.tar.gz (80KB): files from Qt S60 GIT tree that are missing for a Linux build (needed to compile Qt tools natively for Linux)
(many thanks to Francisco Keppler for hosting the last two files on his web site!)
Installation
- 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/S60 support:
- Install gnupoc:
- For S60 3.1:
- For S60 5.0:
- Install gnupoc wrappers and native tools:
- Install OpenC (skip this step if using S60 5.0):
- Finally, install Qt/S60 (it will take some time because some tools need to be compiled for Linux):
# root directory where all SDK files will be installed
GNUPOC_ROOT=$HOME/gnupoc
# toolchain directory
TOOLCHAIN_DIR=$GNUPOC_ROOT/csl_gcc
# S60 SDK directory (replace "3.1" with "5.0"
# for S60 5.0)
S60_SDK_DIR=$GNUPOC_ROOT/symbian-sdks/3.1
# Qt SDK directory
QT_S60_DIR=$GNUPOC_ROOT/qt_s60
# wrapper directory (used by gnupoc)
WRAPPER_DIR=$GNUPOC_ROOT/bin
# where all downloaded files are located
SRC_DIR=$HOME/downloads
mkdir -p $TOOLCHAIN_DIR
tar -C $TOOLCHAIN_DIR -xvjf \
$SRC_DIR/gnu-csl-arm-2005Q1C-arm-none-symbianelf-i686-pc-linux-gnu.tar.bz2
tar -xvzf $SRC_DIR/gnupoc-package-1.13.tar.gz
cd gnupoc-package-1.13
patch -p1 -i $SRC_DIR/qt_s60_gnupoc.patch
cd sdks
./install_gnupoc_s60_31 \
$SRC_DIR/S60-SDK-200634-3.1-Cpp-f.1090b.zip \
$S60_SDK_DIR
cd sdks
./install_gnupoc_s60_50 \
$SRC_DIR/S60_5th_Edition_SDK_v1_0_en.zip \
$S60_SDK_DIR
./install_wrapper $WRAPPER_DIR
cd ../tools
./install_eka2_tools $TOOLCHAIN_DIR
# adjust EKA2TOOLS variable to point to correct location
sed -i "s,EKA2TOOLS=.*,EKA2TOOLS=$TOOLCHAIN_DIR/bin," \
$WRAPPER_DIR/gnupoc-common.sh
cd ../sdks
chmod +x install_openc.sh
./install_openc.sh \
$SRC_DIR/OpenC-1.5.5b-beta.zip \
$S60_SDK_DIR
chmod +x install_qt_s60.sh
./install_qt_s60.sh \
$SRC_DIR/qt-embedded-s60-preview-4.5.2-tower.exe \
$S60_SDK_DIR \
$QT_S60_DIR \
$SRC_DIR/qt-s60-extra-files.tar.gz
Usage
After installation is completed, the usage is very simple. You need to setup a few environment variables, so tools like qmake, bldmake, abld, makesis etc. are found:
export PATH=$WRAPPER_DIR:$QT_S60_DIR/bin:$PATH
export EPOCROOT=$S60_SDK_DIR/ # trailing "/" is required!
export QMAKESPEC=$QT_S60_DIR/mkspecs/symbian-abld
Optionally, you can create a gnupoc_env.sh file with the lines above, using this command:
cat > $GNUPOC_ROOT/gnupoc_env.sh << EOF
export PATH=$WRAPPER_DIR:$QT_S60_DIR/bin:\$PATH
export EPOCROOT=$S60_SDK_DIR/ # trailing "/" is required!
export QMAKESPEC=$QT_S60_DIR/mkspecs/symbian-abld
EOF
Then, every time you need to set the variables, you could simply use:
. $GNUPOC_ROOT/gnupoc_env.sh
Note the “.” (dot) before the gnupoc_env.sh. It says that the contents of the gnupoc_env.sh file will be run in the current shell session, as if you typed them by hand.
To actually build some Qt code, use these commands:
cd path/to/source
qmake # assuming the code already has a .pro file
make DEL_FILE=rm ABLD=abld release-gcce
makesis -c <project>_gcce_urel.pkg <project>.sis
And to clean the source:
make DEL_FILE=rm ABLD=abld distclean
Notes:
- Be sure to use qmake from Qt/S60. Otherwise the generated Makefiles will be for your host system
- The trailing slash on the EPOCROOT variable is important
Known issue and workaround
The .sis file generated by the instructions above, although installable on the device, does not actually work (clicking on the application icon makes the phone “hang” for a while, but then it returns to the Symbian menu). The workaround is to compile and link some files from Qt/S60 sources directly into the application. For that, just add a “qts60main.pri” file to your application’s source directory, with the following content:
QT_SOURCE_TREE = $$QMAKE_INCDIR_QT/..
DEPENDPATH += $$QT_SOURCE_TREE/src/s60main
HEADERS += \
qts60mainapplication.h \
qts60mainappui.h \
qts60maindocument.h
SOURCES += \
qts60mainapplication.cpp \
qts60mainappui.cpp \
qts60main.cpp \
qts60maindocument.cpp \
qts60main_mcrt0.cpp
LIBS -= qtmain
QMAKE_LIBS -= qtmain
MMP_RULES += \
"SOURCEPATH $$QT_SOURCE_TREE/src/s60main" \
"START RESOURCE s60main.rss" \
"HEADER" \
"TARGETPATH /resource/apps" \
"END"
Edit the .pro file and add this line:
include(qts60main.pri)
Then try again the sequence of commands listed on the previous section (qmake; bldmake …). I’m not sure why this happens, and I need to check whether this is an issue specific to Linux.
TODO
- Remove need to set “DEL_FILE=rm ABLD=abld” when calling make distclean/relase-*
- Send patches to Martin’s gnupoc and Qt/S60
- Investigate issue with s60main static library not working
- Compile Qt/S60 from sources on Linux
- Make it work with S60 3.0 too (although Qt/S60 does not support it officially)
- Make Symbian emulator (epoc.exe) work under Linux (currently it crashes under WINE)
Making icecream monitor (icemon) work on Jaunty May 21, 2009
Posted by lizardo in Debian/Ubuntu, Hints.Tags: icecc
comments closed
While I have been using Ubuntu 8.04 LTS (hardy) in my work laptop (for the very same reasons I used dapper for a long time), I knew that some Ubuntu 9.04 (jaunty) users were having problems with icemon (the icecream monitor) not working, i.e., not showing any nodes. I did not investigate the reasons behind this, but a colleague reported that he could successfully make it work by using the older version from intrepid.
So here goes a small how-to on installing the older icecc-monitor version (from intrepid) in jaunty:
- Download the icecc-monitor .deb package from http://packages.ubuntu.com/intrepid/i386/icecc-monitor/download
- Install the package with:
- The step above will successfully install the package, but in a future whole-system upgrade, it will again install the newer (buggy) version. To avoid that, you can tell dpkg to lock the package version, using the following command:
$ sudo dpkg -i icecc-monitor_*.deb
$ echo icecc-monitor hold | sudo dpkg --set-selections
If necessary, you can unlock it anytime using the command:
$ echo icecc-monitor install | sudo dpkg --set-selections
I did not check yet whether this has already been reported to the Launchpad, if anyone knows, feel free to comment.
“undefined reference to `vtable for …’ errors” in Qt derived classes April 24, 2009
Posted by lizardo in Hints.Tags: qt
comments closed
If you ever come across an error like this when compiling C++ code with Qt derived class definitions:
g++ -Wl,--no-undefined -o test test.o -L/usr/lib -lQtGui -lQtCore -lpthread
test.o: In function `main':
test.cpp:(.text+0x2c): undefined reference to `vtable for MyClass'
collect2: ld returned 1 exit status
make: *** [test] Error 1
It is probably because either you defined a class in a .cpp file or you forgot to add some header file to the HEADERS variable in the .pro file.
This happens because moc (Qt’s meta-object compiler) only runs on header files by default (and only on those listed in the HEADERS variable), therefore it did not generate the necessary MOC code for that class.
The fix is to simply move the class definition to a header, and make sure it is added to the HEADERS variable in the qmake project file.
Setting up libc6 sources for analysis on Debian/Ubuntu May 31, 2008
Posted by lizardo in Debian/Ubuntu, Linux.comments closed
I used to work on development of a tracing tool at work, that required me reading some glibc code to understand internals of core library functions (following the “Use the source, Luke” Open Source principle for developer documentation). I use Ubuntu, so it seemed simpler to use its glibc sources so I don’t have to recompile glibc myself. Here are the instructions I use for setting up my environment for glibc code navigation (tested on Hardy running on x86):
# gcc 4.2 is required to configure libc6 $ sudo apt-get install build-essential gcc-4.2 # download sources $ sudo apt-get source libc6 $ cd glibc-2.6.1/ # the "configure_i686" rule also calls other rules that # unpack the sources and apply distro-specific patches $ ./debian/rules configure_i686 # create a tags file to easily navigate between functions with Vim $ cd build-tree/glibc-2.6.1/ && ctags -R --exclude=.pc
My Boomerang TODO list April 5, 2008
Posted by lizardo in Reverse Engineering.comments closed
I have some items on my TODO list regarding Boomerang. Here they are:
- migrate functional testsuite to DejaGNU (on progress)
- increase test code coverage by writing new tests
- update/fix/extend unit tests
Migration to dejagnu will allow to write more flexible functional tests, such as ones to test for error handling. Right now, Boomerang’s functional testsuite only covers the decompilation phase (as far as I can see), and only covers 48.1% of code (according to gcov/lcov). Next, I plan to increase this coverage percentage by writing new tests (and understanding the code a bit more on the way) and finally, once I start getting hands dirty on coding, I will fix/extend unit tests.
These are my short term plans. Long term plans are (not detailed yet): remove dependency on some (old, unmaintained) third-party tools, such as NJMC toolkit and old bison++/flex++ (this needs to be discussed on the mailing list); reuse code where possible, instead of reimplementing things like the PE/ELF/etc. parsers; make boomerang more modular, possibly allowing to compile it as a shared library (already possible?) or replacing some algorithms; take a look at DCC code (now GPL licensed); experiment with new concepts on the RE/Decompilation research field.
Wine, the Windows “emulator” March 24, 2008
Posted by lizardo in Linux, Windows.comments closed
Just saw some good news about Wine approaching 1.0 stable release. It remembered me of how capable Wine is now. Some years ago, I would try running an application under Wine and hope it would at least show something and not crash. Nowadays, when I find some Windows application I need to use, I first try running it under Wine and if it does not work as I like, I fall back to QEMU or VMWare. Hopefully, for most applications I have tried, Wine worked just fine.
Boomerang and gcov March 12, 2008
Posted by lizardo in Reverse Engineering.comments closed
Last night I tried enabling coverage in boomerang compilation. It seems it will not be as easy as I thought. Gcov is failing to find source files, although the .gcda and .gcno files are being generated and are on the correct location. Snippet from gcov error:
$ gcov c/ansi-c-parser.gcda -o c -b >/dev/null
ansi-c.y:cannot open source file
/usr/local/lib/bison.cc:cannot open source file
ansi-c-parser.cpp:cannot open source file
In this case the source file is in c/ansi-c-parser.cpp, but it insists on looking for it in the current directory. For this specific case, I figured out the errors are due to #line directives generated by bison++, but there are various errors like this. I’ll look into them at another time. Currently, I’m investigating unexpected errors reported by the functional testsuite (more on this later).