Difference between revisions of "User:Cip"

From openZIM
Jump to navigation Jump to search
(Work in progress)
(work in progress (compile zimlib for symbian))
Line 1: Line 1:
Work in progress
Work in progress (Files not yet uploaded, qt gui app section missing)


HOWTO build zimlib for Symbian
HOWTO build zimlib for Symbian
Line 50: Line 50:


== Patch SDK ==
== Patch SDK ==
 
===e32def.h===
Do the fix described in http://wiki.forum.nokia.com/index.php/KIS001022_-_Open_C:_Initializer_element_is_not_constant_error_on_GCCE_platform to the
Do the fix described in http://wiki.forum.nokia.com/index.php/KIS001022_-_Open_C:_Initializer_element_is_not_constant_error_on_GCCE_platform to the
/Symbian/9.2/S60_3rd_FP1/EPOC32/include/e32def.h file.
/Symbian/9.2/S60_3rd_FP1/EPOC32/include/e32def.h file.
Line 56: Line 56:
Else libzma won´t compile. (/Symbian/9.2/S60_3rd_FP1/EPOC32/include/e32def.h:2803: error: initializer element is not constant).
Else libzma won´t compile. (/Symbian/9.2/S60_3rd_FP1/EPOC32/include/e32def.h:2803: error: initializer element is not constant).


TODO perhaps add patch for emulator as well here
===Emulator===
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.
 
http://wiki.forum.nokia.com/index.php/TSS000651_-_NCNList_KERN-EXEC_3_panic_when_starting_the_S60_3rd_Edition,_FP1_emulator
 


==Install sources==
==Install sources==
Line 85: Line 90:
are currently not supported on symbian. (And probably support does not make to much sense anyway).
are currently not supported on symbian. (And probably support does not make to much sense anyway).


Create a new project in carbide.c++
===liblzma===
* File/New/Symbian OS C++ Project
* Empty Project for Symbian
* Project name: zimlib
** Location should point to the xz containng the zimlib code
* In SDK and build configurations select for S60_3rd_FP1:
** Emulator Debug (WINSCW) [S60_3rd_FP1]
** Phone Debug (GCCE) [S60_3rd_FP1]
** Phone Release (GCCE) [S60_3rd_FP1]
* Accept the default settings in the Empty Project Section.
 
 
===liblzma=
Used version:
Used version:
:http://tukaani.org/xz/xz-4.999.9beta.tar.gz
:http://tukaani.org/xz/xz-4.999.9beta.tar.gz
Line 103: Line 96:
Extract to carbide workspace and rename folder to xz.
Extract to carbide workspace and rename folder to xz.
(Carbide does not like the - in the folder name.)
(Carbide does not like the - in the folder name.)
Create a new project in carbide.c++
* File/New/Symbian OS C++ Project
* Empty Project for Symbian
* Project name: xz
** Location should point to the xz containng the bzip2 code
* In SDK and build configurations select for S60_3rd_FP1:
** Emulator Debug (WINSCW) [S60_3rd_FP1]
** Phone Debug (GCCE) [S60_3rd_FP1]
** Phone Release (GCCE) [S60_3rd_FP1]
* Accept the default settings in the Empty Project Section.


There is also an embedded, more lightweight, version available, I have not tried that yet but
There is also an embedded, more lightweight, version available, I have not tried that yet but
Line 125: Line 108:
Extract to carbide workspace bzip2/src.
Extract to carbide workspace bzip2/src.


In Carbide.c++ create a new project bzip2
* File/New/Symbian OS C++ Project
* Empty Project for Symbian
* Project name: bzip2
** Location should point to the bzip2 containng the bzip2 code
* In SDK and build configurations select for S60_3rd_FP1:
** Emulator Debug (WINSCW) [S60_3rd_FP1]
** Phone Debug (GCCE) [S60_3rd_FP1]
** Phone Release (GCCE) [S60_3rd_FP1]
* Accept the default settings in the Empty Project Section.
===libzim===
==Port projects==
==Port projects==
Main porting effort is that symbian does not support autoconf.
Main porting effort is that symbian does not support autoconf.
===Build configuration===
 
===Build configuration and config files===
 
Symbian uses group/<projectname>.mmp and group/bld.inf to configure the build process.
Symbian uses group/<projectname>.mmp and group/bld.inf to configure the build process.
These files have to be copied from TODO to the projects group directory replacing
the existing files for each of the libraries. Close carbide.c++ before doing this.
When build errors occur later, it's a good idea to check whether the provided group
file are actually used.


Additionally for some of libraries (liblzma) config.h files, for unix builds generated with autoconfs have to be added. Copy them from TODO to into the projects in the symbian directory. ====config.h settings====
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 buildandconfig.zip 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:
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
* xz/symbian/config.h
Line 154: Line 146:




===Source patches===


Basically you can extract sourcepatches.zip 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.


===_WIN32 defines ===
Note, that the patches (TODO except PID?) should not break other target platforms and it would make sense to integrate them into the repositories.
Some (TODO) 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.  
 
=====_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:
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:


* bzip2
====== bzip2======
** bzip2/src/bzlib.h
:bzip2/src/bzlib.h
Add  
Add  


<pre>
// Symbian compiler defines _WIN32 in builds for emulator.
// Symbian compiler defines _WIN32 in builds for emulator.
#ifdef __SYMBIAN32__
#ifdef __SYMBIAN32__
   #undef _WIN32
   #undef _WIN32
#endif
#endif
</pre>


before line
before line
<pre>
#ifdef _WIN32
</pre>
:bzip2/src/bzip2.c


#ifdef _WIN32
** bzip2/src/bzip2.c
add after
add after
<pre>
#define BZ_LCCWIN32  0
#define BZ_LCCWIN32  0
</pre>


<pre>
#if defined(_WIN32) && !defined(__CYGWIN__)&& !defined(__SYMBIAN32__)
#if defined(_WIN32) && !defined(__CYGWIN__)&& !defined(__SYMBIAN32__)
 
</pre>
TODO removeunzcrash.c nessary?
 
TODO 
======liblzma======
 
:xzsrcliblzmaapilzma.h
* liblzma
** xzsrcliblzmaapilzma.h
Add
Add
 
<pre>
// Symbian compiler defines _WIN32 in builds for emulator.
// Symbian compiler defines _WIN32 in builds for emulator.
#ifdef __SYMBIAN32__
#ifdef __SYMBIAN32__
   #undef _WIN32
   #undef _WIN32
#endif
#endif
</pre>


before
before


<pre>
#ifndef LZMA_API_IMPORT
#ifndef LZMA_API_IMPORT
*zimlib
</pre>
** zimlibincludezimzim.h
 
======zimlib======
:zimlibincludezimzim.h
 
Add
Add


<pre>
// Symbian compiler defines _WIN32 in builds for emulator.
// Symbian compiler defines _WIN32 in builds for emulator.
#ifdef __SYMBIAN32__
#ifdef __SYMBIAN32__
   #undef _WIN32
   #undef _WIN32
#endif
#endif
</pre>


before
before


<pre>
#ifdef _WIN32  
#ifdef _WIN32  
</pre>
=====Other=====
======zimlib======
:zimlibsrcuuid.cpp
add
<pre>
#include <unistd.h>
</pre>
If this is a problem for other builds a #ifdef __SYMBIAN32__ would have to be added additionally.
==Build==
With Project/Build All Configurations each of the projects can be built.
Build zimlib as last project.
==Use==
To use zimlib in a symbian project the following line have to be included into the projects mmp file:
<pre>
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
STATICLIBRARY zimlib.lib
STATICLIBRARY bzip2.lib
STATICLIBRARY liblzma.lib
LIBRARY  libm.lib
LIBRARY libz.lib
OPTION CW -wchar_t on
</pre>
Additionally the heap and stacksize should be increased, for example by:
<pre>
//Deault heapsize not large enough to decrypt lzma
EPOCSTACKSIZE 0x10000
EPOCHEAPSIZE 0x5000 0x1000000
</pre>


TODO problem in uuid.getpid
===
==Install on phone==
==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.  
Tested on N82. Should work on all S60 3rd edition FP1 (e.g. N95), and later.  

Revision as of 22:21, 14 March 2010

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 5.10.1.1007

http://www.activestate.com/activeperl/downloads/

S60 SDK

http://forum.nokia.com

Used: S60 3rd Edition SDK, FP1

http://sw.nokia.com/id/178ab2d1-b59d-4236-96e6-215ae212c223/S60-SDK-200634-3.1-Cpp-f.1090b.zip
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

Carbide.c++

http://forum.nokia.com

Used version 2.3

http://sw.nokia.com/id/dcc2430b-57b4-4a66-ba07-1d8635691f3e/Carbide_cpp_v2_3_en.exe

QT

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

http://qt.nokia.com/downloads/symbian-cpp

Used QT libraries 4.6.2 for Symbian (LGPL)

http://get.qt.nokia.com/qt/source/qt-symbian-opensource-4.6.2.exe

Open C/C++ plug-in

http://forum.nokia.com

Used version 1.6

http://sw.nokia.com/id/fbe59b85-a621-404b-94d7-94ca818e576a/s60_open_c_cpp_plug_in_v1_6_en.zip

SVN client

Used tortoise svn

http://tortoisesvn.net/downloads

Patch SDK

e32def.h

Do the fix described in http://wiki.forum.nokia.com/index.php/KIS001022_-_Open_C:_Initializer_element_is_not_constant_error_on_GCCE_platform 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).

Emulator

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.

http://wiki.forum.nokia.com/index.php/TSS000651_-_NCNList_KERN-EXEC_3_panic_when_starting_the_S60_3rd_Edition,_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.

zimlib

See also RELEASES

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:

http://svn.openzim.org/svnroot/trunk/zimlib

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

liblzma

Used version:

http://tukaani.org/xz/xz-4.999.9beta.tar.gz

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.

libbz2

Used version:

http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz

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 buildandconfig.zip 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 sourcepatches.zip 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:

bzip2
bzip2/src/bzlib.h

Add

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

before line

#ifdef _WIN32
bzip2/src/bzip2.c

add after

#define BZ_LCCWIN32  0
#if defined(_WIN32) && !defined(__CYGWIN__)&& !defined(__SYMBIAN32__)
liblzma
xzsrcliblzmaapilzma.h

Add

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

before

#ifndef LZMA_API_IMPORT
zimlib
zimlibincludezimzim.h

Add

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

before

#ifdef _WIN32 
Other
zimlib
zimlibsrcuuid.cpp

add

#include <unistd.h>

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


Build

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

Build zimlib as last project.

Use

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

STATICLIBRARY zimlib.lib
STATICLIBRARY bzip2.lib
STATICLIBRARY liblzma.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
EPOCSTACKSIZE 0x10000
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