Tuesday 14 July 2009

notes/howto setup symbian dev environment linux

You can set up a symbian development environment in a couple of hours.
Follow these instructions: http://www.martin.st/symbian/ they are very good.
Here are my extra notes on the install.
They might be useful to someone else (or myself again in future).

I have a nokia E65 and although it is very grotty (interface-wise) it has nice hardware. I like being able to make software for my electronic devices. I played with python apps on the phone a bit. Symbian signing is very awkward for sharing and even playing/experimenting/developing little apps.

I http://www.openstreetmap.org a bit and I use a bluetooth GPS with my mobile to collect the data with WhereAmI http://www.symbianos.org/whereami which is a really nice map display and GPS collection tool. It can also collect GSM cellid information, or rather, it hints it can but it doesn't on my phone. So I want to get the source and see what the problem is and can I get it working.

================================================================================


http://www.google.ie/search?q=symbian+development+linux

http://wiki.forum.nokia.com/index.php/Symbian_development_on_Linux_and_OS_X
The three main approaches. Realistically there seems to be one sensible approach.

Symbian's build system is based mostly on perl. And a bit of make.
It seems heavyish and they should have used make perhaps but the symbian apps are all going to be small enough really. These scripts are modified to work on unix. This matches symbian build system very closely. Seems to be best supported.

Other options: Replacing the build system with makefiles giving a lighter build system or integrating the build system with IDEs don't seem to be well supported.




Start here.


http://www.martin.st/symbian/ based on GnuPoc project
"for S60 3rd ed and UIQ 3, you need the EKA2 toolchain."
Of course we're going to build the compiler from source and not take binaries >;)
And of course we're going to install the extra gnupoc tools so we don't have to use wine too much.


What is going to be installed.



1. Working in this area and tools/scripts + source code are going here:
export SYM_WORKING_DIR=$HOME/src/mobile

2. compiler is going here:
export SYM_COMPILER_DIR=$HOME/csl-gcc

3. SDK is going here:
export EPOCROOT=$HOME/symbian-sdks/s60_3_fp2_v11/


Install steps.



0. Signup to nokia and start SDK download


http://www.forum.nokia.com/Tools_Docs_and_Code/Tools/Platforms/S60_Platform_SDKs/
3rd ed fp2 v1.1 430Mish


1. install gnupoc tools and 2. install compiler



mkdir -p $SYM_WORKING_DIR; cd $SYM_WORKING_DIR
wget http://www.martin.st/symbian/gnupoc-package-1.13.tar.gz
# http://www.codesourcery.com/sgpp/lite/arm/releases/2005Q1C # and form fill and get OR:
wget http://www.martin.st/symbian/gnu-csl-arm-2005Q1C-arm-none-symbianelf.src.tar.bz2

tar -zxvf gnupoc-package-1.13.tar.gz
cd gnupoc-package-1.13
cd tools

less README
# I needed to install bison, I also do other development so possibly already had a
# bunch of other devel packages and tools installed. If it needs bison it probably
# needs make/autoconf/gcc packages
sudo apt-get install bison

./install_csl_gcc ../../gnu-csl-arm-2005Q1C-arm-none-symbianelf.src.tar.bz2 $SYM_COMPILER_DIR

# I also did need libssl-dev and already had zlib
sudo apt-get install libssl-dev
dpkg -l |grep zlib

./install_eka2_tools $SYM_COMPILER_DIR
#that goes off and gets cross-binutils and compiler and builds them ....


Here is the error I got that showed I needed bison. "Unexcpected(sic) error"
Flailing newbie help trap.

bison -d -o gengtype-yacc.c gengtype-yacc.y
make[1]: bison: Command not found
make[1]: [gengtype-yacc.h] Error 127 (ignored)
gcc -c -g -O2 -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-error -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -I. -I. -I./. -I./../include \
gengtype-lex.c -o gengtype-lex.o
gcc: gengtype-lex.c: No such file or directory
gcc: no input files
make[1]: *** [gengtype-lex.o] Error 1
make[1]: Leaving directory `$HOME/src/mobile/gnupoc-package-1.13/tools/csl-build/gcc-csl-arm/gcc'
make: *** [all-gcc] Error 2
Unexcpected error: aborting.


Here is the error I got that showed I needed ssl-dev package.
It actually did say you needed openssl in the README.
Flailing newbie help trap.

g++ -Wall -gstabs+ -I../include -DTEST -ggdb -c signutils.cpp -o signutils.o
signutils.cpp:36:25: error: openssl/evp.h: No such file or directory
signutils.cpp:37:25: error: openssl/pem.h: No such file or directory
signutils.cpp:44:25: error: openssl/err.h: No such file or directory



2-and-a-half. Read up on symbian build tools and


No excuses for slacking off while compiling/installing/downloading.

Also poke inside the scripts you've installed.

Read more about gnupoc here: http://gnupoc.sourceforge.net/HOWTO/
http://gnupoc.sourceforge.net/
gnupoc_install gnupoc-utils
http://web.archive.org/web/*/http://www.wayfinder.it/resources/uiq_gnupoc.php

Reading the "Build tools guide" is helpful to know more about what the build scripts are doing.
http://developer.symbian.com/main/documentation/sdl/symbian94/sdk/doc_source/ToolsAndUtilities94/BuildTools/index.html
How to use bldmake, How to use abld, etc.


3. install the SDK


# Example on(sic) installing an SDK:

## no! don't get your own unshield. sudo apt-get install unshield
export PATH=`pwd`/unshield:$PATH

cd $SYM_WORKING_DIR/gnupoc-package-1.13/sdks
mv ~/Downloads/S60_3rd_Edition_SDK_Feature_Pack_2_v1_1_en.zip ../..

./install_gnupoc_s60_32 ../../S60_3rd_Edition_SDK_Feature_Pack_2_v1_1_en.zip ~/symbian-sdks/s60_3_fp2_v11

# needed to do this (lzma_decoder.h and any SDK includes need to be findable from working area)
# perhaps should be working inside the SDK dir structure
cd $SYM_WORKING_DIR/whereami_trunk/sis
ln -s $HOME/symbian-sdks/s60_3_fp2_v11/epoc32 ../../

## I did this: don't know did it work, switched to using gcc
cp $HOME/symbian-sdks/s60_3_fp2_v11/epoc32/tools/uidcrc.exe $HOME/.wine/drive_c/windows/
cp $HOME/symbian-sdks/s60_3_fp2_v11/epoc32/tools/make.exe $HOME/.wine/drive_c/windows/
#MESSY:
cp $HOME/symbian-sdks/s60_3_fp2_v11/epoc32/tools/*.exe $HOME/.wine/drive_c/windows/
ls $HOME/symbian-sdks/s60_3_fp2_v11/epoc32/release/winscw/udeb/sdkw.exe



Info on figuring out problems with how to set up environment for SDK:

### unshield did not work for me initially at this stage until I figured out where it was and set PATH
./unshield/unshield -V
./unshield/unshield -D3 l _e/data2.cab
find $HOME/symbian-sdks/s60_3_fp2_v11/epoc32/tools -name \*.orig -exec rm {} \;
cd $HOME/symbian-sdks/s60_3_fp2_v11/epoc32/tools; chmod a+x *.pl bldmake abld makmake bmconv rcomp makesis epoc eshell petran pfsdump setupcomms elf2e32 mifconv makekeys signsis extmake rtf2ptml cjpeg

### Take a look at the SDK, the install doc, the examples

ls $HOME/symbian-sdks/s60_3_fp2_v11/
epoc32/ S60_3rd_Edition_FP2_SDK_for_Symbian_OS_Installation_Guide_V1.1.pdf
examples/ s60cppexamples/
GCCE_readme.txt s60tools/
Nokia_EULA.txt series60doc/

ls $HOME/symbian-sdks/s60_3_fp2_v11/s60cppexamples/
addressbook clientserverasync dynamicsettinglist helperfunctions localization note progressbar webclient
aiwconsumerbasics clientserversync filelist helpexample locationlandmarksrefappfors60 npbitmap query
animation contacts finditemtestapp hwrmtestapp locationlandmarksuirefapp ocrexample readme.txt
audiostreamexample datamobility focusevent imopenapiexample locationrefappfors60 openc_ex registration
brctlsampleapp directorylocalizerex graphics isvtelcallapp locationsatviewrefapp openglex richtexteditor
chat _doc guiengine isvtelinfoapp messaging popupfield sipexample
clfexample driveinfo helloworldbasic listbox myview popuplist uniteditorex

cat $HOME/symbian-sdks/s60_3_fp2_v11/s60cppexamples/readme.txt
To open the Example Application Help documentation, please go to the _doc folder
and double-click the index.htm file found there.

wine: could not load L"C:\\windows\\system32\\make.exe": Module not found
make: *** [FINALicons] Error 126

ls $HOME/csl-gcc/bin/
arm-none-symbianelf-addr2line arm-none-symbianelf-cpp arm-none-symbianelf-gcov arm-none-symbianelf-ranlib bmconv makekeys signsis
arm-none-symbianelf-ar arm-none-symbianelf-g++ arm-none-symbianelf-ld arm-none-symbianelf-readelf copy makesis uidcrc
arm-none-symbianelf-as arm-none-symbianelf-gcc arm-none-symbianelf-nm arm-none-symbianelf-size del mifconv
arm-none-symbianelf-c++ arm-none-symbianelf-gcc-3.4.3 arm-none-symbianelf-objcopy arm-none-symbianelf-strings elf2e32 rcomp
arm-none-symbianelf-c++filt arm-none-symbianelf-gccbug arm-none-symbianelf-objdump arm-none-symbianelf-strip extmake rem


find $EPOCROOT -name make.exe
$HOME/symbian-sdks/s60_3_fp2_v11/epoc32/tools/make.exe
$HOME/symbian-sdks/s60_3_fp2_v11/epoc32/tools_orig/make.exe


cp $HOME/symbian-sdks/s60_3_fp2_v11/epoc32/tools/uidcrc.exe $HOME/.wine/drive_c/windows/
cp $HOME/symbian-sdks/s60_3_fp2_v11/epoc32/tools/make.exe $HOME/.wine/drive_c/windows/


perl -S makmake.pl -D $HOME/src/mobile/whereami_trunk/group/s60_v3/whereami WINSCW
ERROR: Unable to identify a valid CodeWarrior for Symbian OS installation
make: *** [MAKEFILEwhereami] Error 255


MESSY:
cp $HOME/symbian-sdks/s60_3_fp2_v11/epoc32/tools/*.exe $HOME/.wine/drive_c/windows/
$HOME/symbian-sdks/s60_3_fp2_v11/epoc32/release/winscw/udeb/sdkw.exe






4. try out hello world


cd ~/symbian-sdks/s60_3_fp2_v11/s60cppexamples
cd helloworldbasic/group/
bldmake bldfiles
abld build gcce urel
cd ../sis
makesis helloworldbasic_gcce.pkg helloworldbasic.sis


Yay. Install finished




Install this in your .bashrc




# This goes in my .bashrc or symbian environment setup script:
export SYM_WORKING_DIR=$HOME/src/mobile
export SYM_COMPILER_DIR=$HOME/csl-gcc
export PATH=$PATH:$HOME/symbian-sdks/s60_3_fp2_v11/epoc32/tools
export PATH=$PATH:$SYM_COMPILER_DIR/bin
export EPOCROOT=$HOME/symbian-sdks/s60_3_fp2_v11/




Now play with WhereAmI



# everyday commands:
cd $SYM_WORKING_DIR/whereami_trunk
cd group/s60_v3

bldmake bldfiles
abld build gcce urel # this works instead

cd ../../sis
makesis whereami_s60_v3.pkg whereami_s60_v3_jco.sis
signsis whereami_s60_v3_jco.sis whereami_s60_v3_jco.sisx mycert.cer mykey.key
cd ../../group/s60_v3




cd $SYM_WORKING_DIR
svn co https://svn.symbianos.org/whereami/trunk/ whereami_trunk

# And this is how I can work quickly compile and make .sis for whereami
# put this in a script or README or notes or blog somewhere
cd $SYM_WORKING_DIR/whereami_trunk
cd group/s60_v3
bldmake bldfiles
#abld build winscw udeb #? needs wine, .. make.exe problem?
abld build gcce urel # this works instead

cd ../../sis
makesis whereami_s60_v3.pkg whereami_s60_v3_jco.sis

# and key signing to make sisx, don't know does this help much?
# privately made key. My phone is a bit hacked so I can install any .sis on it.
# first make key and cert for yourself
[[ ! -f mykey.key ]] || [[ ! -f mycert.cer ]] &&
makekeys -cert -expdays 3650 -dname "CN=Name Surname OU=Development O=Company Name C=UK EM=foo@bar.com" mykey.key mycert.cer
# sign application each time you need to
signsis whereami_s60_v3_jco.sis whereami_s60_v3_jco.sisx mycert.cer mykey.key

# how clean make/build?
# this does a bit of it anyway:
rm $HOME/symbian-sdks/s60_3_fp2_v11/epoc32/build${HOME}/src/mobile/whereami_trunk/group/s60_v3/whereami*/*/urel/*.{o,exe}




WhereAmI needed lzma_decoder.h



This is done above to resolve this problem:

cd $SYM_WORKING_DIR/whereami_trunk/sis
ln -s $HOME/symbian-sdks/s60_3_fp2_v11/epoc32 ../../



WARNING: Can't find following headers in User or System Include Paths
"lzma_decoder.h"
(User Inc Paths "$HOME/src/mobile/whereami_trunk/src/" "$HOME/src/mobile/whereami_trunk/group/s60_v3/" "$HOME/src/mobile/whereami_trunk/inc/" "$HOME/src/mobile/whereami_trunk/data/")
Dependency list for "$HOME/src/mobile/whereami_trunk/src/nmeaparser.cpp" may be incomplete



dpkg-query -L lzma-dev # no, LzmaDecode.h
# here it is:
svn co https://svn.symbianos.org/lzma/
cd lzma/C/Symbian/group
#oops! it's part of SDK:
$HOME/symbian-sdks/s60_3_fp2_v11/epoc32/include/lzma_decoder.h




GSM_LOCATION enable



GSM_LOCATION is compiled out in the source code as you get it now.


+++ add to this file group/s60_v3/whereami.mmp (after GPS_LBS)
MACRO GSM_LOCATION
#define GSM_LOCATION


svn diff >../whereami_enable_gsm_location.patch
meld .

1 comment:

gaoithe said...

And here's an example of how to use symbian SDK and use your own build makefiles.
https://wiki.mozilla.org/Mobile/Symbian/Build