From openZIM
Revision as of 22:21, 14 March 2010 by Cip (talk | contribs) (work in progress (compile zimlib for symbian))
Jump to navigation Jump to search

Work in progress (Files not yet uploaded, qt gui app section missing)

HOWTO build zimlib for Symbian

Setup environment (Windows)

Active Perl

5.6.1 or later, tested with


Used: S60 3rd Edition SDK, FP1
newer should work, older versions won´t work for TODO application, while zimlb may work .

Also install arm tool chain, installer will ask you to do so


Used version 2.3


QT is not required for the zimib, but used in the TODO application

Used QT libraries 4.6.2 for Symbian (LGPL)

Open C/C++ plug-in

Used version 1.6

SVN client

Used tortoise svn

Patch SDK


Do the fix described in to the /Symbian/9.2/S60_3rd_FP1/EPOC32/include/e32def.h file.

Else libzma won´t compile. (/Symbian/9.2/S60_3rd_FP1/EPOC32/include/e32def.h:2803: error: initializer element is not constant).


While not strictly necessary, I'd recommend to install the following patch. Without it I had problems running the emulator for the QT reader application.,_FP1_emulator

Install sources

First open Nokia/Carbide.c++ to create workpace

E.g. c:SymbianCarbideworkspace

Following description assumes that source is installed to subfolders in this workspace.



Use svn to get zimlib source.

This howto assumes that you have zimlib directly in the carbide workspace. (And not for example zim/zimlib).

If you are using tortoisesve, right click on workspace folder in windows explorer, select 'SVN Checkout...' and put the following into URL of repository:

Checkout directory should be automatically set to: c:SymbianCarbideworkspacezimlib

Note that zimreader and zimwriter are currently not supported on symbian. (And probably support does not make to much sense anyway).


Used version:

Extract to carbide workspace and rename folder to xz. (Carbide does not like the - in the folder name.)

There is also an embedded, more lightweight, version available, I have not tried that yet but may make sense to use it. However, also the regular version is running fine on the mobile phone.


Used version:

Extract to carbide workspace bzip2/src.

Port projects

Main porting effort is that symbian does not support autoconf.

Build configuration and config files

Symbian uses group/<projectname>.mmp and group/bld.inf to configure the build process.

Additionally for some of libraries (liblzma) config.h files, for unix builds generated with autoconfs have to be added.

Install buildfiles

Close Carbide.c++.

Extract TODO to the workspace containing the libraries.

Open carbide.c++.

Select File/Import

Choose General/Existing Projects into Workspace

Select root directory: The workspace. (default C:SymbianCarbideworkspace)

Finish import.

Buildfile settings

The .mmp files defines - amongst others - the source files, include path, libraries, and target file.

bld.inf mainly serves to select the include files to be exported.

config.h settings

The config.h files have been generate in cygwin with autoconf and have been manually changed until build has been successul. Two changes worth to mention here:

  • xz/symbian/config.h

Bool type definition changed to int. Should be checked why necessary and whether safe.

  • zimlib/symbian/config.h

Change TODO

Source patches

Basically you can extract into the workspace and overwrite existing files. However, this will cause problems if different versions of the library sources are used, therefore it is recommended to do the patches manually as described in the following sections.

Note, that the patches (TODO except PID?) should not break other target platforms and it would make sense to integrate them into the repositories.

_WIN32 defines

Some of the libs use _WIN32 to define some configurations. While this is not a problem for builds for the device, it causes problems in builds for the emulator, as it defines _WIN32 as well. Therefore the source files have to be changed so that in case __SYMBIAN32__ is defined _WIN32 is ignored. The following changes have to be done:



// Symbian compiler defines _WIN32 in builds for emulator.
#ifdef __SYMBIAN32__
   #undef _WIN32

before line

#ifdef _WIN32

add after

#define BZ_LCCWIN32  0
#if defined(_WIN32) && !defined(__CYGWIN__)&& !defined(__SYMBIAN32__)


// Symbian compiler defines _WIN32 in builds for emulator.
#ifdef __SYMBIAN32__
   #undef _WIN32




// Symbian compiler defines _WIN32 in builds for emulator.
#ifdef __SYMBIAN32__
   #undef _WIN32


#ifdef _WIN32 


#include <unistd.h>

If this is a problem for other builds a #ifdef __SYMBIAN32__ would have to be added additionally.


With Project/Build All Configurations each of the projects can be built.

Build zimlib as last project.


To use zimlib in a symbian project the following line have to be included into the projects mmp file:

SYSTEMINCLUDE   epoc32includestdapis
SYSTEMINCLUDE   epoc32include
SYSTEMINCLUDE   epoc32includestdapissys
SYSTEMINCLUDE   epoc32includestdapisstlport 

// Using main() as entry point
STATICLIBRARY   libcrt0.lib
LIBRARY         libc.lib 
LIBRARY         euser.lib

LIBRARY  libstdcpp.lib

LIBRARY  libm.lib
LIBRARY libz.lib

OPTION CW -wchar_t on

Additionally the heap and stacksize should be increased, for example by:

//Deault heapsize not large enough to decrypt lzma
EPOCHEAPSIZE 0x5000 0x1000000

Install on phone

TODO qt sample app description still missing

Tested on N82. Should work on all S60 3rd edition FP1 (e.g. N95), and later. 5th edition (5800, N97) may work as well, but not tested.

Install QT

Install qt.sis from qt installation directory or TODO

Note: Project also build a sis with integrated qt installer (TODO filename), using Nokia smart intaller, but installation did not work for me due to signing issue.

Install TODO.sis