Trying to compile GMP - MPZ part for Symbian OS

Marian Kechlibar marian.kechlibar at circletech.net
Tue May 27 18:00:37 CEST 2008


Hello Torbjorn,

> When you say "compilable under Symbian", do you mean to actually
> compile on the Symbian system, i.e., not cross-compile?
>   
My error. I thought about "compilable for Symbian". Obviously, my 
English is not up to the task.
>   I started with the source code for GMP 4.2.2. I compiled this source
>   code for the generic architecture under Linux and GCC tools (I used
>   the same GCC toolchain to create a Linux DLL as well, it works just
>   fine, so the following problems are probably not the compiler's
>   fault).  Only after success with generic, I would go on with the
>   ARM-specific code ...
>   
> Ah, the processor is ARM.
>   
Yes. For Symbian prior to 9, it is ARM4, for Symbian 9 on, it is ARM5.

However, if someone wants to develop for Symbian, they usually rely on 
SDKs provided by
Nokia, and those SDKs (which include device emulators - very useful for 
development) are
designed to co-operate with Nokia Carbide.c++, an IDE derived from 
Eclipse. The emulator
builds are built using WINSCW compiler (a compiler from Code Warrior, 
tweaked by Nokia),
and the ARM builds are built using GCCE (again, modified by Nokia, you 
cannot simply use
an up-to-date GCC). So, the future users of the library would need a 
distribution that compiles
for non-ARM target for the emulator, and for ARM target for the real 
device. That is the reason
why I started with "generic".

>   Then I took the resulting .h and .c files to the Windows partition,
>   created a Symbian OS project and added those files to the
>   project. Then I edited the config.h file and some other files to get
>   rid of compiler problems, as far as I could understand them. I am
>   attaching my list of edits. The list is not complete yet and it will
>   need some tweaking; I am sending it just as an informative material.
>   
> Oh, so you run configure under GNU/Linux, and then compile on Windows?
> That is a convoluted way of building that we will hardly support in an
> official GMP release...
>
>   #  Preparation phase
>   1. On Linux, run the ./configure script with build=none-unknown. Run make.
>      (you have to do this in order to create files fib-tables.h, fac_ui.h and mp_bases.h,
>      which will be needed).
>      
> I assume you mean -build=none-unknown.  You probably want to say
> --host=arm-blah-blah.
>
> [snip horrific windows commands]
>
> Man, you're really determined to make this work from Windows!
>
> Isn't there a GNU cross compilation environment that you could run
> from GNU/Linux?  That should save you lots of headache, and might very
> well allow you to use an unmodified GMP source tree.
Unfortunately, all attempts of open-sourcers to create a viable 
environment for Symbian development
under Linux are half-hearted at best. I would guess that 99% of Symbian 
developers do develop under Windows,
using either Carbide.c++, or, in older versions, MSVC. This is not very 
comfortable, but Nokia does not seem
to be very responsive to requests for Linux development environment: 
they are rejecting the very idea since
2004, and I partially understand why, since they basically emulate the 
whole Symbian OS environment,
and it is probably quite expensive to port all this emulation to a very 
different OS.

Myself, the only reason why I have Windows installed, is development for 
Symbian OS. All other work
is done under Suse Linux. Same with my colleagues.

Anyway, if this port is to be useful for other Symbian developers, it 
will have to work under Windows,
since this is the standard in the community. I think that the best way 
would be to have a specific header
file (config.h, gmp-impl.h) for Symbian, and use generic sources for 
WINSCW emulation environment,
and possibly use ARM for the device build. I think I could be able to 
supply you with information
on the Symbian specifics, and a manageable MMP file.

In the meantime, I managed to compile and link the library with the flag 
you mentioned. For Symbian 9,
that was enough. For Symbian 8 and earlier, I had to remove several 
static writable data (Symbian 8 and
earlier will not tolerate static writable data in DLLs). These usually 
were global variables; I made them
const, which killed some functionality (like mpz_random). I did not have 
time to test the functionality
in the emulator, or a real device, yet. I believe I can do it tomorrow.

BR

Marian



More information about the gmp-bugs mailing list