Running Qt for S60 SDK on Linux

*** These instructions have been superseded by the GnuPoc and Qt for Symbian unofficial installers, described in this post***

 

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:

(many thanks to Francisco Keppler for hosting the last two files on his web site!)

Installation

  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
    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

  3. Install ARM toolchain:
  4. mkdir -p $TOOLCHAIN_DIR
    tar -C $TOOLCHAIN_DIR -xvjf \
      $SRC_DIR/gnu-csl-arm-2005Q1C-arm-none-symbianelf-i686-pc-linux-gnu.tar.bz2

  5. Unpack gnupoc sources and apply the patch that adds Qt/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.patch

  7. Install gnupoc:
    • For S60 3.1:
    • cd sdks
      ./install_gnupoc_s60_31 \
        $SRC_DIR/S60-SDK-200634-3.1-Cpp-f.1090b.zip \
        $S60_SDK_DIR

    • For S60 5.0:
    • cd sdks
      ./install_gnupoc_s60_50 \
        $SRC_DIR/S60_5th_Edition_SDK_v1_0_en.zip \
        $S60_SDK_DIR

  8. Install gnupoc wrappers and native tools:
  9. ./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

  10. Install OpenC (skip this step if using S60 5.0):
  11. cd ../sdks
    chmod +x install_openc.sh
    ./install_openc.sh \
      $SRC_DIR/OpenC-1.5.5b-beta.zip \
      $S60_SDK_DIR

  12. Finally, install Qt/S60 (it will take some time because some tools need to be compiled for Linux):
  13. 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)

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.

12 Responses to Running Qt for S60 SDK on Linux

  1. Paulo Cesar says:

    Finally! Thanks for the instructions, I will try it on my N78

  2. grego says:

    Didn’t quite work for me, failing in the last step with:


    ./release/winscw/udeb/Phonon.dll
    ./release/winscw/udeb/qsvg.dll
    ./release/winscw/udeb/QtCore.dll
    ./release/winscw/udeb/qjpcodecs.lib
    ./release/winscw/udeb/qsvg.lib
    ./release/winscw/udeb/QtSql.lib
    ./release/winscw/udeb/qts60plugin_3_1.dll
    patching file bin/syncqt
    Hunk #1 FAILED at 41.
    Hunk #2 FAILED at 653.
    Hunk #3 FAILED at 791.
    Hunk #4 FAILED at 806.
    4 out of 4 hunks FAILED — saving rejects to file bin/syncqt.rej
    patching file mkspecs/common/symbian/symbian.conf
    Hunk #1 FAILED at 92.
    Hunk #2 FAILED at 127.
    2 out of 2 hunks FAILED — saving rejects to file mkspecs/common/symbian/symbian.conf.rej
    patching file qmake/generators/symbian/symmake_abld.cpp
    Hunk #1 FAILED at 293.
    1 out of 1 hunk FAILED — saving rejects to file qmake/generators/symbian/symmake_abld.cpp.rej
    patching file src/s60main/qts60mainappui.cpp
    Hunk #1 FAILED at 159.
    1 out of 1 hunk FAILED — saving rejects to file src/s60main/qts60mainappui.cpp.rej
    Removing temporary files…
    harri@pluto:~/gnupoc-package-1.13/sdks$ less install_qt_s60.sh
    harri@pluto:~/gnupoc-package-1.13/sdks$ ls /home/harri/Download/S60/qt
    qt-embedded-s60-preview-4.5.2-tower.exe
    qt-embedded-s60-preview-src-4.5.2-tower.zip
    qt_libs.sis
    qt-s60-extra-files.tar.gz
    qt_s60_gnupoc.patch
    grego@pluto:~/gnupoc-package-1.13/sdks$

  3. grego says:

    Btw. rerunning the last step claims that “Everything is Ok”, but that is not quite true yet.

    I would be very nice to get this working, so let me know if you need any other info.

    • grego says:

      Patch failed because of dos line endings, here is a patch:

      *** install_qt_s60.sh~ 2009-08-04 11:15:49.000000000 +0300
      — install_qt_s60.sh 2009-08-04 12:36:59.000000000 +0300
      ***************
      *** 44,49 ****
      — 44,53 —-
      if [ ! -d “$QT_S60_DIR” ]; then
      mv $TEMP/\$OUTDIR/bin $QT_S60_DIR
      # Various fixes for Linux support
      + ./dos2unix $QT_S60_DIR/bin/syncqt
      + ./dos2unix $QT_S60_DIR/mkspecs/common/symbian/symbian.conf
      + ./dos2unix $QT_S60_DIR/qmake/generators/symbian/symmake_abld.cpp
      + ./dos2unix $QT_S60_DIR/src/s60main/qts60mainappui.cpp
      patch -p1 -d $QT_S60_DIR < qt-s60-fixes.patch
      # Fixes for S60 3.0
      # TODO: S60 3.0 not supported yet

      Now it fails soon after with:

      qmake/Makefile.unix
      Preparing build tree…

      The specified system/compiler port is not complete:

      ~/gnupoc/qt_s60/mkspecs/linux-g++-64/qplatformdefs.h

      Please contact qt-bugs@trolltech.com.

      Removing temporary files…

      • lizardo says:

        @grego: forgot to mention that I only tested these instructions on x86 32 bits. It may require changes for x86-64 support, only not sure what :(. If you make it work for 64 bits, let me know the changes so I can update the instructions.

        Regarding the dos line endings, I was sure the patch applied correctly even with them (it worked on Ubuntu 8.04 x86 32 bits, at least). I’ll recheck and fix them.

  4. Pingback: Installing Qt for Symbian SDK 4.6.1 on Linux « Anderson Lizardo's Blog

  5. Michael Behman says:

    Thank you so much Lizardo for these instructions, I’m trying to use them but with S60 2.6 instead. I’m getting some weird error while making the project:

    $ make DEL_FILE=rm ABLD=abld release-gcce
    bldmake bldfiles
    BLDMAKE ERROR: ERROR: CPP executable not found in path
    BEGIN failed–compilation aborted at /home/michael/gnupoc/symbian-sdks/2.6/epoc32/tools//checkgcc.pm line 84.
    Compilation failed in require at /home/michael/gnupoc/symbian-sdks/2.6/epoc32/tools//prepfile.pm line 21.
    BEGIN failed–compilation aborted at /home/michael/gnupoc/symbian-sdks/2.6/epoc32/tools//prepfile.pm line 21.
    Compilation failed in require at /home/michael/gnupoc/symbian-sdks/2.6/epoc32/tools//modload.pm line 49.

    make: *** [abld] Error 1

    I’m guessing the error is in the double slash used to locate the files ( “epoc32/tools//” ), you can see from this link that someone else that was using S60 5.0 had this error as well:
    http://wiki.forum.nokia.com/index.php/Talk:Develop_Symbian_C%2B%2B_on_Linux_using_Gnupoc_and_Eclipse_CDT

    Any ideas on how to fix it?

  6. lizardo says:

    As far as I know, S60 SDKs are not backward compatible, so if you build your package on the 3.1 SDK it will not run on your 2.6 based phone. But you are better off asking these questions on the symbian forums.

    Besides, the Qt binaries only work on 3.1 and newer phones (I tried once on o 3.0 phone and it didn’t work).

  7. arul says:

    i’m facing trouble in qt,that,while open project and when i save …what path should i give in linux platform

Comments are closed.