On Patching S60 SDKs for GCCE 4 Compatibility

I’ve tried GCCE version 4 before for building Symbian software, but have been somewhat put off by all the warnings it produces, mostly due to incompatibilities with the header files in the existing S60 SDKs. Well, I finally managed to get a working S60 application built with GCCE 4 without any warnings. Mind you, this was just one application, and not built with the full Symbian toolchain, but still.

I used the S60 5th Edition SDK with a number of patches, some of which I have posted here. The version of GCCE that I used is Sourcery G++ Lite 2010q1-190, which is the latest at the time of writing, and corresponds to GCC version 4.4.1. (When downloading it, I’d recommend opting for a tarball of the binaries where suitable. These in my opinion are the easiest to install, as mere unpacking is required.)

There are blog posts and discussion regarding some of the compiler warnings that appear with GCCE 4. Patching an SDK to remove the warnings is considerably easier than the task the Software Freedom Fighters are faced with, as one need not be able to build Symbian OS, but just compile against it, and as there is no moving target, but rather whichever SDK release you want to use.

The Forum Nokia How to use GCCE 4 with Symbian SDKs wiki page lists a number of reasons as to why a switch to version 4 of GCC might be beneficial. However, for those like me who have previously been sticking with the 2005q1 release (GCC version 3.4.3) of GCCE that the S60 SDKs have been shipping with as standard (and still do), perhaps the most important benefit of switching to a more recent compiler is that it should finally be possible to have static writable data in DLLs. The bug preventing that has apparently been fixed by now.

An additional benefit is that a lot of the features in the upcoming C++0x standard should be available by invoking the compiler with the -std=c++0x switch. Refer to this table to see which features are supported by GCC 4.4.