Compiling ScummVM/Windows CE/Old GCC

From ScummVM :: Wiki
Jump to navigation Jump to search

This page should be considered as deprecated instructions on how to tweak and build the GCC cross compiler, which is based on the VLC port. For current builds, this is not required. Please refer to the Compiling_ScummVM/Windows_CE page.

GCC Build Instructions

The VLC port of GCC requires some prep work before it's ready for action. There are two major problems with it: It does not honor the #pragma pack() directive and there is a store layout bug for packed structs. Hence, it needs to be rebuilt. As a welcome aside though, the procedure described in the following subsections can be applied to linux or cygwin based environment. This means that the cross compiler can be installed onto a Windows (Cygwin) machine as well.

It has been reported that the packages needed for Cygwin are: gcc, make, sed, bison, flex, texinfo, patch, cvs, gettext, gettext-devel, perl, svn. Also some CR/LF conversion may be needed by utilities such as dos2unix and unix2dos.

Cross compiler

The build process is carried out in two steps, first the binutils and then the gcc cross compiler. Begin by designating a directory where all source downloads and build will take place.

(Note: the patches by the VLC guys target specific GCC/binutils versions. We'll rebuild those exact versions as they are good enough for the time being.)


Checkout the binutils source, as described in the GNU Binutils page but designating a revision date as well:

cvs -z 9 -d login
{enter "anoncvs" as the password}
cvs -z 9 -d co -D 20050514 binutils

CD into the root of the source tree and patch with the three VLC binutils patches (may patch with a little fuzz). Configure the build:

./configure --target=arm-wince-pe --prefix=PREFIX_TO_CROSS_COMPILER

(PREFIX_TO_CROSS_COMPILER is the path where the cross compiler will be installed. In linux it is: /usr/local/wince/cross-tools)

Make and make install. You may need to manually run ranlib on some generated libs during making.


Checkout the GCC source:

svn -q checkout -r {20050511} svn:// gcc

(Note the date. It does not match the date in the VLC patches. Also, later revisions contain severe bugs)

Now come the patches.

  • First apply the VLC GCC patch (maybe a little fuzz here as well).
  • Then, patch gcc/stor-layout.c with the patch described here.
  • Finally, in gcc/config/arm/arm.h, stick the following define somewhere (before the architecture define is OK):

In the root of the GCC source tree, make a directory called wince. CD into it and create a file called with the following stuff (substitute PREFIX_TO_CROSS_COMPILER), and run it:


../configure --with-gcc --with-gnu-ld --with-gnu-as --target=arm-wince-pe --prefix=PREFIX_TO_CROSS_COMPILER --disable-threads --disable-nls --enable-languages=c++ --disable-win32-registry --disable-interwork --disable-multilib
make install

Finish up

We need to copy over some stuff from the full GCC tarball. Get the binary tarball and unpack it somewhere.

  • Copy recursively all of usr/local/wince/cross-tools/include/ into your PREFIX_TO_CROSS_COMPILER/include.
  • Copy all of the libs in usr/local/wince/cross-tools/lib into your PREFIX_TO_CROSS_COMPILER/lib (except libiberty.a).
  • CD into your PREFIX_TO_CROSS_COMPILER/arm-wince-pe/lib and make the following two symbolic links:
ln -s ../../lib/corelibc.lib crt0.o
ln -s ../../lib/coredll.lib c.lib

Done :-)

(Note: In linux, it is much easier to get the binary tarball, extract it into the root of the filesystem, and then build the binutils and GCC replacing essentially the offending files (C++ compiler etc). This final step in this case is not be required)