# Symbian development on Linux and OS X

## Introduction

Since version 1.03 of my gnupoc package, I've combined SDK patches, updated tool sources and gcc patches into one (slighly larger) package, instead of distributing lots of patches separately. People interested in the old approach can read the old version of this page.

The main goal of this gnupoc patch collection is to be able to build symbian projects on unix-like systems with as little changes as possible to the actual projects. This means that it e.g. uses the same mmp files and external makefiles for icons as on Windows.

My patches and tools are based on the original GnuPoc project.

Using this package, you can build applications for S60 1st, 2nd and 3rd ed, and UIQ 3, on Linux and OS X. The SDKs can be unpacked and binaries and sis packages be built completely without wine.

### News/changes

• Version 1.13 (March 31, 2009) - Updated the S60 5.0 SDK scripts and patches to the 1.0 version of the SDK, recently released, some minor fixes.
• Version 1.12 (January 22, 2009) - Fixed compilation with gcc 4.3, integrated a fix for ar in both EKA1 and EKA2 gcc (needed on e.g. Ubuntu 8.10), fixed building DLLs on the S60 3.2 SDK (thanks to Jean-Yves Baudy for pointing this out), assorted fixes for S60 5.0, fix building of the EKA1 gcc on x86_64/linux, initial support for compiling context-sensitive help (requires wine), other misc fixes
• Version 1.11 (October 3, 2008) - Initial support for S60 5.0
• Version 1.10 (September 4, 2008) - compilation fixes for g++ 4.3 (thanks to Mrinal Kalakrishnan and Jakob Kemi for sending patches!), some minor new features implemented in signsis
• Version 1.09 (March 31, 2008) - adds support for S60 3.2, and has some minor bugfixes and new features for the included tools
• Version 1.08 (February 27, 2008) - fixes a lot of issues on OS X Leopard. Seems to work fine on most Leopard machines, if you experience problems please let me know.
• Version 1.07 (December 04, 2007) - fixes a regression in compiling the EKA1 gcc
• Version 1.06 (November 26, 2007) - fixed a bug in elf2e32 which prevented it from working on S60 3.1, fixed some compilation problems on FreeBSD, added an initial patch for the S60 3.2 SDK beta (but no installer script yet, since I haven't found a tool able to unpack the installer). Thanks to all who reported problems and helped solve them!
• Version 1.05 (September 14, 2007) - a bugfix for signsis, deflate compression support for petran and elf2e32, build elf2e32 by default, an initial version of a svgt-binary encoder
• Version 1.04 (September 2, 2007) - fixes for rcomp, petran and makesis for running on 64-bit linux, small bugfixes in mifconv and elf2e32, better error reporting in the new rcomp, completely new makesis for Symbian 9 SIS files, use unshield instead of i6comp.exe for extracting S60 SDKs
• Version 1.03 (August 13, 2007) - support for UIQ 3.0 and 3.1, added most tools except gcc into the package, support for symbian 9 resources in rcomp, elf2e32 replacement, mifconv replacement, support for building the old GCC toolchain on OSX/intel
• Version 1.02 (April 7, 2007) - calls external makefiles using wine, some more assorted bugfixes
• Version 1.01 (March 5, 2007) - clarified the license, added instructions on doing a read-only installation of the SDKs, some other slight bugfixes
• Version 1.0 (October 15, 2006) - initial release

Download the latest package above. First you'll have to install a toolchain for the SDK you want to use. For S60 1st and 2nd ed, you need the EKA1 toolchain, for S60 3rd ed and UIQ 3, you need the EKA2 toolchain.

## Installing the EKA1 toolchain

In addition to the GnuPoc archive, you need the source to the modified gcc release (local copy).

Unpack the GnuPoc archive, enter the tools directory, and compile gcc using the install_gcc_539 script:

tar -zxvf gnupoc-package-1.03.tar.gzcd gnupoc-package-1.03cd tools./install_gcc_539 ../../gcc-539-2aeh-source.tar.bz2 ~/symbian-gcc

If you want to have a compiler for the THUMB target, build that with the isntall_gcc_539_thumb script similarly.

Then you can install the rest of the tools. These aren't strictly necessary if wine is available, but recommended. (If omitted, the build scripts uses the exe versions in the SDK instead.)

./install_eka1_tools ~/symbian-gcc

## Installing the EKA2 toolchain

In addition to the GnuPoc archive, you need CodeSourcery's GCC. For Linux, you can choose to download the binaries, for other platforms you can compile it from source. (There's also local copies of the Linux binaries and the source.)

To install the binaries, just unpack them:

mkdir csl-gcccd csl-gcctar -jxvf ../gnu-csl-arm-2005Q1C-arm-none-symbianelf-i686-pc-linux-gnu.tar.bz2

To compile it from source instead, unpack the GnuPoc archive and use the install_csl_gcc script:

tar -zxvf gnupoc-package-1.03.tar.gzcd gnupoc-package-1.03cd tools./install_csl_gcc ../../gnu-csl-arm-2005Q1C-arm-none-symbianelf.src.tar.bz2 ~/csl-gcc

Then you can install the rest of the tools. These aren't strictly necessary if wine is available. (If omitted, the build scripts uses the exe versions in the SDK instead.)

cd gnupoc-package-1.03cd tools./install_eka2_tools ~/csl-gcc

## SDKs

After downloading the GnuPoc package above, you still need to get the SDK you want to use from Forum Nokia or UIQ Developer Community. The following versions are supported at the moment:

 Version File name Install script Comments S60 1st Edition, FP1, WINS nS60_sdk_v1_2.zip install_gnupoc_s60_12 S60 2nd Edition, WINS s60_sdk_v2_0.zip install_gnupoc_s60_20 Working emulator S60 2nd Edition, FP1, WINS S60_SDK_2_1_NET.zip install_gnupoc_s60_21 S60 2nd Edition, FP1, CW S60_SDK_v21c_CW.zip install_gnupoc_s60_21_cw Working emulator S60 2nd Edition, FP2, WINS s60_2nd_fp2_sdk_msb.zip install_gnupoc_s60_26 Working emulator S60 2nd Edition, FP2, CW s60_2nd_fp2_sdk.zip install_gnupoc_s60_26_cw Working emulator S60 2nd Edition, FP3 s60_2nd_sdk_fp3.zip install_gnupoc_s60_28 S60 3rd Edition, Maintenance Release S60-SDK-0616-3.0-mr.3.749.zip install_gnupoc_s60_30 S60 3rd Edition, FP 1 S60-SDK-200634-3.1-Cpp-f.1090b.zip install_gnupoc_s60_31 S60 3rd Edition, FP 2 S60-3.2-SDK-f.inc3.2130.zip install_gnupoc_s60_32 S60 5th Edition S60_5th_Edition_SDK_v1_0_en.zip install_gnupoc_s60_50 UIQ 3.0 UIQ3.0SDK.exe install_gnupoc_uiq_30 UIQ 3.1 UIQ3.1SDK.exe install_gnupoc_uiq_31

(Everything is tested using Wine 0.9.15 and remote X to X11.app on OS X, things might work better or worse on other setups.)

Example on installing an SDK:

tar -zxvf gnupoc-package-1.03.tar.gzcd gnupoc-package-1.03cd sdks./install_gnupoc_s60_26 ../../s60_2nd_fp2_sdk_msb.zip ~/symbian-sdks/s60_26

The install scripts makes almost all files lowercase and patches the build scripts. The exception to the lowercase rule is the GLES include directory and libGLES_CM.lib, for compatibility reasons.

In order to use the SDK, you'll have to set the EPOCROOT environment variable to point to your SDK and add the toolchain directory and the epoc32/tools directory of the SDK to your PATH. This might be cumbersome if frequently switching between different SDKs. To ease that situation, you can install some wrapper scripts:

./install_wrapper ~/gnupoc

If you've installed the toolchains to other directories than mentioned here, edit ~/gnupoc/wrapper.sh and set EKA1TOOLS and EKA2TOOLS to point to where you've installed them. With these wrappers, you only have to have this single directory in your PATH, and depending on the EPOCROOT variable, the correct toolchain is included and scripts from the current SDK are called.

### Wine setup

If you're going to use some tools through wine, you have to copy uidcrc.exe from the epoc32/tools directory in the SDK to a directory in the wine path, e.g. ~/.wine/drive_c/windows. By default, wine is only needed for using the windows compilers, but you might use it to run the original tools instead of the native replacements, if you have problems with the native ones.

If using external makefiles (as for building icons in 3rd edition) with wine, copy make.exe and mifconv.exe, too. make.exemifconv.exe from the 3.0 SDK, since mifconv.exe in 3.1 has some problems starting within wine. Note, this is only needed if omitting the extra EKA2 tools above. probably can be used from any SDK version, but you'll need

In order to build binaries for the emulator, you'll need a windows compiler. Unfortunately, these have to be copied from a real installation. (Perhaps it's possible to do the complete installation of them within wine?)

For the WINS compiler, I've used Visual C++ Toolkit 2003, set up according to this page. Just copy over the C:/Program Files/Microsoft Visual C++ Toolkit 2003 directory to e.g. ~/.wine/drive_c/msvcpp2003.

For the WINSCW compiler, you can install Carbide C++ from Forum Nokia. These instructions apply to Carbide C++ 1.0, for newer versions you might need to use slightly different paths. Copy C:/Program Files/Carbide/plugins/com.nokia.carbide.cpp.support_1.0.0 to e.g. ~/.wine/drive_c/codewarrior.

These have to be added to the wine path. Edit ~/.wine/user.reg, and add this after the WINE REGISTRY Version 2 line:

[Environment]"Path"="c://msvcpp2003//bin;c://codewarrior//Symbian_Tools//Command_Line_Tools;c://windows;c://windows//system"

(Of course, if you've already got a similar environment definition in that file, add it there instead.)

When using the CW compiler, you'll also need to add these variables to your unix environment (the perl build scripts need them, adding them to the wine environment isn't enough, and if set in the unix environment, they're also automatically available in wine):

export MWCSym2Includes="c://codewarrior//symbian_support//MSL//MSL_C//MSL_Common//include;c://codewarrior//symbian_support//MSL//MSL_C++//MSL_Common//include;c://codewarrior//symbian_support//MSL//MSL_Extras//MSL_Common//include"export MWSym2Libraries="+c://codewarrior//symbian_support"export MWSym2LibraryFiles="MSL_All_MSE_Symbian.lib;gdi32.lib;user32.lib;kernel32.lib"

### Using it

After installing everything, you're able to compile things in the same way as on windows.

In order to compile most projects, the usage of upper/lowercase for filenames must be cleaned up somewhat. The install scripts clean up the usage of lower/upper case in the bundled examples (by forcing them to lowercase), so the should all be buildable directly. (Or at least it tries to, it might not work reliably in stranger examples.)

To build the hello world example on a S60 3rd edition SDK, do the following:

export PATH=~/gnupoc:${PATH}export EPOCROOT=~/symbian-sdks/s60_30/cd ~/symbian-sdks/s60_30/s60ex/helloworldbasic/groupbldmake bldfilesabld build gcce urelcd ../sismakesis helloworldbasic_gcce.pkg helloworldbasic.sis For 1st and 2nd edition, use the paths for those SDKs and build using abld build armi urel instead. The .pkg files for those examples are written for the THUMB target. Either update the .pkg file and replace all occurrances of thumb with armi or build them using abld build thumb urel (which requires that you built a thumb compiler). On 3rd edition, all sis files must be signed before they can be installed. If you haven't already got a key and certificate pair, generate them: makekeys -cert -expdays 3650 -password mykey.key mycert.cer This will prompt for information to enter into the certificate, and create a certificate valid for 10 years. (To create a certificate without a password, just leave out -password. The makekeys tool included in this package has a similar but not identical syntax compared to the makekeys tool in the real SDKs.) Then sign the sis file using this certificate: signsis helloworldbasic.sis helloworldbasic.sisx mycert.cer mykey.key The newly generated .sisx file can then be installed on a device. The version of makesis for Symbian 9 included in this package is also able to sign the package directly when creating it, using a built-in certificate. To use this feature, just add the command line parameter -c. ## Contact 在linux平台下面开发Symbian S60应用程序 北京理工大学 20981 陈罡 不可否认，偶是linux的fans（这是真的，偶的家人可以作证，家里的所有电脑和笔记本、iPod、Ps2、Psp、PDA、手机，都被偶装上了 linux。。。）。但是生活所迫，在公司的时候都要在M$的系统里面开发应用，感觉很不爽。开发symbian s60的手机应用已经有一段时间了，突发奇想希望试试能否在linux环境下面开发S60手机应用程序。于是乎google了一下，果然，即使这么一个小 想法也早有国外的“大拿”们捷足先登了。

http://www.martin.st/symbian/

(1)准备工作，下载一些sdk包和工具包：
http://www.martin.st/symbian/gnupoc-package-1.11.tar.gz，这个是gnupoc的脚本包
S60-SDK-200634-3.1-Cpp-f.1090b.zip，这是sdk包，到nokia的论坛上下载
gnu-csl-arm-2005Q1C-arm-none-symbianelf-i686-pc-linux-gnu.tar.bz2这是arm的编译器，需要从下面的url下载：
http://www.codesourcery.com/gnu_toolchains/arm/releases/2005Q1C

(2)开始安装arm编译器
mkdir ~/works/csl-gcc
cd ~/works/csl-gcc
tar -jxvf ~/down/gnu-csl-arm-2005Q1C-arm-none-symbianelf-i686-pc-linux-gnu.tar.bz2

(3)安装gnupoc和for symbian的arm-gcc工具链

cd ~/works
tar jxvf ~/down/gnupoc-package-1.11.tar.gz .
cd gnupoc-package-1.11/tools/
./install_eka2_tools ~/works/csl-gcc

(4)安装s60的sdk
cd ~/works/gnupoc-package-1.11/sdks
./install_gnupoc_s60_31 ~/down/60-SDK-200634-3.1-Cpp-f.1090b.zip ~/works/epoc_sdk/s60_31

(5)指定s60的一些命令行工具的包装
./install_wrapper ~/works/gnupoc

(6)设置环境变量(可以在/etc/profile里面加，也可以在.bashrc里面加)
export PATH=~/works/gnupoc:$PATH export EPOCROOT=~/epoc_sdk/s60_31/ (注意，这里的EPOCROOT末尾的反斜杠‘/’是一定要加上去的，这是偶的血泪教训！！) (7)好了，可以做实验了，编译一个hello world试试： cd ~/works/epoc_sdk/s60_31/s60ex/helloworldbasic/group bldmake bldfiles abld build gcce urel cd ../sis makesis helloworldbasic_gcce.pkg (8)手工生成一个自签名证书（有开发者证书的朋友可以跳过这一步） makekeys -cert -expdays 3650 -password mykey.key mycert.cer (9)对sis进行签名 signsis helloworldbasic_gcce.sis helloworldbasic_gcce.sisx mycert.cer mykey.key (10)真机上测试一下 好了，如果可以看到sisx文件，就代表你已经生成了手机上可以用的安装包了。linux下面蓝牙设备一般用obex协议栈操作。 (11)插入usb蓝牙适配器，初始化系统，(以下操作需要在root权限下面操作) # su - # modprobe hci_usb # modprobe rfcomm # hciconfig hci0 up 这个时候，应该看到如下的输出： BD Address: xx:xx:xx:xx:68:9F ACL MTU: 192:8 SCO MTU: 64:8 UP RUNNING PSCAN ISCAN RX bytes:1860 acl:10 sco:0 events:88 errors:0 TX bytes:1432 acl:10 sco:0 commands:52 errors:0 Features: 0xff 0xff 0x0f 0x00 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: HOLD SNIFF PARK Link mode: SLAVE ACCEPT Name: 'xxxxxxxxx' Class: 0x000100 Service Classes: Unspecified Device Class: Computer, Uncategorized HCI Ver: 1.1 (0x1) HCI Rev: 0x20d LMP Ver: 1.1 (0x1) LMP Subver: 0x20d Manufacturer: Cambridge Silicon Radio (10) (12)打开手机的蓝牙通信，开始扫描蓝牙设备，得到蓝牙设备的Mac地址 # hcitool scan 结果将输出如下的内容： Scanning... 00:80:37:B5:A8:3A T68i 00:0E:07:1C:AE:1D Nokia N81 (13)可以ping一下这个设备，看看是否可用： # l2ping -c 6 00:0E:07:1C:AE:1D 100 bytes from 00:0E:07:1C:AE:1D id 200 time 39.62ms 100 bytes from 00:0E:07:1C:AE:1D id 201 time 35.25ms 6 sent, 6 received, 0% loss 这就代表蓝牙通了，可以把安装包发给手机了。 (14)可以用sdptool查看一下，是否支持相应的服务（这个不多解释了，一试便知） # sdptool browse local # sdptool browse 00:0E:07:1C:AE:1D (15)用obex_test客户端，直接发送（可以用普通用户操作了）$ cd ~/works/epoc_sdk/s60_31/s60ex/helloworldbasic/sis
\$ obex_test -b 00:0E:07:1C:AE:1D 9  (这里的9代表的是通道号，蓝牙push的通道号是9)
Using Bluetooth RFCOMM transport
OBEX Interactive test client/server.
> c [回车，连接手机的蓝牙push服务]
Connect OK!
Version: 0x10. Flags: 0x00
> p helloworldbasic_gcce.sisx  [回车，开始发送蓝牙push]
PUT file (local, remote)> name=helloworldbasic_gcce.sisx, size=xxxxx
Going to send xxxxx bytes
Made some progress...
Made some progress...
Made some progress...
Made some progress...
Made some progress...
PUT successful!
> q [回车，退出]

 文件: obexsend-v1.tar.bz2 大小: 6KB 下载: 下载

sh obexsend.sh <Mac> <Channel> <filename>

(16)真机测试

hoho，毕竟，gnupoc为许多“骨灰级”的玩家和开发者提供了一个很不错的开发symbian s60的方法。

06-28 4179

04-22 791
06-14 4324
10-04 1636
01-08 2826
11-06 2万+
05-11 3557
©️2020 CSDN 皮肤主题: 酷酷鲨 设计师:CSDN官方博客