Friday, February 16, 2007

compiling mobihf python extension module on linux

As Nokia doesn't seem to provide S60 SDK on Linux (largely due to copyright issues), you could do the compilation (generating the Python extension module in my case) by using either gnupoc or using the how to at Simon Woodside.

Somehow, I was not able to get stuff working using Simon Woodside's instructions, neither gnupoc installation worked straight forward. But I was finally able to use gnupoc to get the Python extension modules compiled (for mobihf, see the previous post).

This is what I did. Follow the gnupoc instructions provided at:

I used the 2.0 SDK for my work (that what is required to get programs compiled for my Nokia 6600). The only thing I am not so sure about the above instructions is whether Wine is really required to get the stuff working. What appears to me is that only if you need the emulator and a few windows only SDK tools. gnupoc use the gnu-arm cross compiler, which is natively compiled for linux and can be obtained from gnupoc site itself. In any case I have done this installation on an FC6 machine, where Wine refuses to work properly (it simply freezes up any windows program i try to execute, even winecfg). So, I have really not cared about this aspect of the SDK while performing the installation and running the tests.

After following the above procedure, I unzipped the Python SDK files from PyS60 site:
into $EPOCROOT/. The .bash_profile file had the following entries for PATH and EPOCROOT:

export EPOCROOT=/data/sdk/gnupoc/


So my SDK is installed in /data/sdk/gnupoc directory. Note that EPOCROOT needs the last '/'.
Also the GCC-ARM cross compiler is placed in /usr/local/er6/bin directory. Now, make sure that all the files in $EPOCROOT/epoc32 are executable.

You will also need to UNIXify (use dos2unix) all the .h files unzipped from the Python SDK distribution.

Finally, you need to edit file in $EPOCROOT/epoc32/tools directory to replace:

$Candidate=uc $Candidate;

to :

$Candidate=lc $Candidate;

near the following line:

if ($Section eq 'PLATFORMS') {

This is to allow it to properly find the armi build directory. After this you should be able to use the SDK for compiling Python extension modules as you do in Windows using:

bldmake bldfiles
abld build armi urel
abld freez
abld build armi urel

Hope all this is of some use to somebody! :)

No comments: