Qtopia Home - Classes - Hierachy - Annotated - Functions - Licenses - Reference

Qtopia Single Exec

Introduction

Qtopia can be compiled in a number of ways. The two most common ways are:

  1. standard compile - which is a fully dynamic build where each application is a separate binary run as a separate process.
  2. single-exec compile - qpe and all the applications are linked together in to a single large binary, however applications are still run as separate processes.

Benefits

There are a number of benefits to single-exec as follows:

Explanation

The main idea behind single-exec is to make it possible to statically link the libraries to the programs. Normally if you did this, the size would be massive, each application having a copy of all the libraries. But by compiling all the application code in to a single binary, this is not a problem. Normally if one did this, you might just have one process, and in that process create new top level widgets of the different applications within that process, but this is not a very stable model, a single application fault brings down the whole system. Therefore it is necessary to run the applications as separate processes.

How it works

When an application is started in single-exec, we fork the server process, and execute the same binary again, but with an argv list that will inform the newly created process what application it should be. This model is very similar to that used by a UNIX tool called busybox which morphs in to different programs based on argv[0].

The size benefit of single-exec comes from static linking. When the linker combines together the code, it performs various size optimizations such as:

Issues

One important thing to be aware of when building single-exec with additional 3rd party components is that the symbols must not clash with those from other applications, use of C++ namespaces would be a very good idea to avoid potential problems caused by this.

Building single-exec

To build Qtopia as a single-exec binary:

The result is that no application binaries or plug-ins will be generated. Instead, the qpe binary will be larger but will contain all the code that would have been in the other binaries.


Copyright © 2005 Trolltech Trademarks
Qtopia version 2.2.0