Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Embedded Systems

Embedded Development With QT/Embedded

Matthias Kalle Dalheimer and Steffen Hansen

, March 01, 2002


Mar02: Making Qt/Embedded Lean and Mean

Making Qt/Embedded Lean and Mean

Although the Qt library is relatively large, you can remove features to make it smaller. We suggest waiting until you know what resources your application requires before making Qt/Embedded leaner because you usually end up with a binary incompatible library once you start stripping classes out of it.

When running the configure script for Qt/Embedded, you can pass the option -qconfig and name of a feature configuration. The options are: minimal, small, medium, large, and local (and if you don't use the -qconfig option, you get everything). Each of those options correspond to a header file in $QTDIR/src/tools/: qconfig-minimal.h, qconfig-small.h, qconfig-medium.h, qconfig-large.h, qconfig.h, and qconfig-local.h.

Trolltech calls those header files "Feature Definition Files." In $QTDIR/doc/html/features.html, you'll find a list of macros, all named QT_NO_<something>. Each of the macros disable a feature in Qt, so when configuring Qt with a custom feature set, write down a list of what you don't need in the file src/tools/qconfig-local.h. You can use one of the other feature definition files as a starting point. Note that the configuration "Everything" corresponds to an empty feature definition file.

Creating a custom Qt usually requires some experimentation and recompiling. It is easy to create a broken feature definition file because the features depend on each other in many ways. The easiest way to strip off some bytes is to remove some of the optional modules from Qt. If you don't need them, you can use:



#define QT_NO_TABLE<br>
#define QT_NO_XML<br>
#define QT_NO_CANVAS</p>

With just those three macros, you save about 350 KB of the final stripped library.

After a successful build, you can strip off symbols with the command: strip -R .note -R .comment $QTDIR/lib/libqte.so*. Remember to use a strip for Linux/ARM to strip the iPAQ binary. If you strip it with the x86-strip, the library will be broken.

— M.K.D. and S.H.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.