Building from Source Code

This package should work fine with Qt/X11 and Qt/Windows, but it is targetted at small handheld devices such as the SHARP SL5000 or Compaq iPAQ, and includes some Qt/Embedded specifics such as additional input methods for virtual keyboards and handwriting recognition. Similarly, it's easy to make an existing Qt-base program part of Qtopia, but usually you will make changes such as simplifying the UI and reducing the screen-space required by the application.

The source code to Qtopia is available from the SourceForge respository, via CVS, or download a recent source code release.

To build the package, you have a number of options, each described in detail below. The instructions assume you have unpacked the source code and all commands are relative to the top-level source directory, which is also referred to as $QPEDIR.

Before building Qtopia, you need to have Qt/X11 installed on your development system, because you need the uic command from Qt/X11 (uic needs the "Everything" configuration as it uses properties). Having Qt/X11 on your system will also allow you to use the Qt Designer under X11, which is a great way to build user interfaces (most of the applications in Qtopia have been designed with the Designer). Note that since Qt/Embedded and Qt/X11 have different library names (libqte and libqt), both can safely be on your $LD_LIBRARY_PATH, or even stored in the same directory.

Note, in Qtopia 1.4.0, some files are missing. It is sufficient to use empty files:

touch $QTDIR/src/kernel/qqnxkeyboard_qws.cpp
touch $QTDIR/src/kernel/qqnxmouse_qws.cpp
touch $QTDIR/src/kernel/qsharedmemory.cpp
touch $QTDIR/src/kernel/qsharedmemory.h
This will be corrected ASAP, but there is furious work on Qtopia at the moment that is delaying the release process.

For all build types you will need to build Qt/Embedded in some way. You can download Qt/Embedded from the Trolltech website.

Before building it, check to see if there is a patch required for Qtopia by looking at $QPEDIR/qt/*.patch for a patch matching the Qt/Embedded version you are compiling with, and apply the patch with:

    cd $QTDIR
    patch -p0 -s <$QPEDIR/qt/qte???-for-qpe.patch
Try to always use the latest Qt/Embedded version and the latest Qtopia version.

Static single-application build

This build method gives the smallest and fastest result, and reflects a type of build that an embedded device might use when the application suite is more-or-less fixed.

  1. Install the Qtopia configurations, which are tuned to the requirements of Qtopia and exclude certain functionality from the Qt library in order to minimize the size of the resulting executable:
        cp ./qt/qconfig*.h $QTDIR/src/tools
    

  2. Build Qt/Embedded statically and with the "-qconfig qpe-single" configuration which uses the files copied above. Be sure to delete any existing dynamic versions as the linker will prefer those:
        cd $QTDIR
        make clean
        ./configure -static -qconfig qpe-single
        make
    

    This creates $QTDIR/lib/libqte.a.

  3. Build the entire Qtopia package as a single application:
        cd back-here
        make clean
        ./configure -static
        make single
    

    This creates $QTDIR/lib/libqpe.a and single/qpe.

  4. Strip the executable:
        strip -R .note -R .comment single/qpe
    

  5. Set the QPEDIR environment variable to the base directory of Qtopia, e.g export QPEDIR=~/qpe

  6. You now have an executable "single/qpe", which includes a complete windowing system, multiple input methods, and a reasonable collection of nifty little applications.

Dynamic build

This build method gives the most extensible result, and reflects a kind of build that an embedded device might use when the application suite is extended by the end-user.

  1. Install the Qtopia configurations, which are tuned to the requirements of Qtopia and exclude certain functionality from the Qt library in order to minimize the size of the resulting executable:
        cp ./qt/qconfig*.h $QTDIR/src/tools
    

  2. Build Qt/Embedded dynamically and with the "-qconfig qpe" option which uses the files copied above:
        cd $QTDIR
        make clean
        ./configure -qconfig qpe
        make
    

    This creates $QTDIR/lib/libqte.so*. You can of course use the default "Everything" Qt configuration, which isn't in the spirit of making small applications, but is useful if you want to have the entire Qt API available.

  3. Build the entire Qtopia package:
        cd back-here
        make clean
        ./configure
        make
    

    This creates $QTDIR/lib/libqpe.so* and bin/*, including a bin/qpe that launchers applications as separate processes (rather than as built-ins which the single-application build does).

  4. Strip the executables, libraries, and plugins:
        strip -R .note -R .comment bin/*
        strip -R .note -R .comment $QTDIR/lib/libqte.so* $QTDIR/lib/libqpe.so*
        strip -R .note -R .comment plugins/*/*
    

  5. Set the QPEDIR environment variable to the base directory of Qtopia, e.g export QPEDIR=~/qpe

  6. You now have a collection of applications in the bin/ directory, which includes a complete windowing system, multiple input methods, and a collection of applications.

  7. To add more applications, see the section below on writing your own applications.

Note that the memory consumption with this type of build is currently excessive due to the details of ELF, but there are a number of tools in production to alleviate this, such as ELF Prelink.

Build for SL5000

To build Qtopia from the sources:

  1. Install the ARM cross-compiler from handhelds.org.

  2. Copy the "library/custom-sharp.h" file to "library/custom.h".
  3. Build the Qt library and the Qtopia package by following the instructions above for the Dynamic build, but add the -xplatform linux-sharp-g++ options when you run both configure commands (you can also add the -depths 16,32 option when compiling Qt since 16bpp is the depth of the SL5000 screen and adding 32 means you can also have pixmaps with alpha-channels).

  4. Run mkipks to regenerate .ipk files which you can then install. You can also just run mkipks with a single control file to regenerate just that package.

Build for iPAQ

To build Qtopia from the sources:

  1. Install Linux on the iPAQ, and possible also some existing parts or Qtopia by following.
  2. Install the ARM cross-compiler from handhelds.org.

  3. Build the Qt library and the Qtopia package by following the instructions above for the Dynamic build, but add the -xplatform linux-ipaq-g++ options when you run both configure commands (you can also add the -depths 16,32 option when compiling Qt since 16bpp is the depth of the iPAQ screen and adding 32 means you can also have pixmaps with alpha-channels). You can also use the <>a href=#single>Single build, but then you'll not be able to interoperate with Qtopia installations on other iPAQs.

  4. Run mkipks to regenerate .ipk files which you can then install. You can also just run mkipks with a single control file to regenerate just that package.