CeGCC cross compiler for PocketPC

This document describes how to build CeGCC. We have a set of scripts that can be used to build the toolchain on GNU/Linux as well as on Cygwin (Windows + the Cygnus layer). These scripts are in the src/ directory, they're called src/build-cegcc.sh and src/build-mingw32ce.sh. They can be used to build the toolchain for the arm-wince-cegcc and arm-wince-mingw32ce target platforms, respectively.

We used to have a separate set of scripts in the scripts/linux directory. These have been removed. The only thing still left there is support for building RPM files, these are distribution packages that can be used on many Linux platforms.

We offer two similar implementations of our product. It is recommended to build and install both of them. They're called after the target platforms they represent :

The examples below all mention the arm-wince-cegcc target. When building for the arm-wince-mingw32ce target, replace cegcc by mingw32ce everywhere, e.g. :

	sh build-mingw32ce.sh

Both toolsets are meant to build applications that run on devices with Windows CE. You may ask "which toolset should I use?" That depends on the application you're trying to build, and because of that, your choice tomorrow may be different from today. If today you're porting a Linux- or Unix-based application to Windows CE, then your best choice is probably the arm-wince-cegcc-gcc compiler. Tomorrow you may be writing a native Windows CE application, and your best choice would then be the arm-wince-mingw32ce-gcc compiler.

Do not confuse your host platform (Linux or Cygwin) with the toolset to use. Both the arm-wince-cegcc and the arm-wince-mingw32ce sets are available on Cygwin (your PC running some version of desktop Windows, with the Cygwin layer installed), as well as on Linux.

1. Building on Linux

This chapter describes building the toolchain on Linux. I would guess that this is similar on Cygwin, but the details on that are in the next chapter. A third chapter in this document describes some common elements, you probably want to look into that. We also assume you've been able to download CeGCC, that's also described below.

The basic steps are very simple :

1.1 The right directory

All of the commands and context below rely on the fact that you're in the src directory of the CeGCC distribution.

1.2 Clean up old installations

Cleanup is recommended :

	rm -rf /opt/cegcc/*
	rm -rf build-cegcc

1.3 Build cegcc completely

	sh build-cegcc.sh

This command will rebuild and install all of cegcc. The directory in which everything is installed is /opt/cegcc, which means that you'll need to put /opt/cegcc/bin in your PATH to make use of the new tools.

Be warned that the build takes a while - you may want to go drink some coffee. An example : my Pentium 4 system (single CPU at 2.4 GHz) needs 27 minutes to build CeGCC. Drinking that much coffee can be hazardous :-)

1.4 More complicated stuff : partial builds, etc

The build scripts have a couple of paramters. In this chapter, we'll explain how to use them.

When you pass the --help parameter to the build script, it'll display a summary of its usage :

	dannypc: {55} sh build-cegcc.sh --help
	Using defaults:
	Building cegcc:
	source: /home/danny/src/cegcc/svn.sf.net/cegcc/trunk/cegcc/src
	build: /home/danny/src/cegcc/svn.sf.net/cegcc/trunk/cegcc/src/build-cegcc
	prefix: /opt/cegcc
	build-cegcc.sh [source dir] [build directory] [prefix dir] [build_opt]
	Valid build options : binutils importlibs w32api dummy_cegccdll
	  bootstrapgcc newlib gcc cegccdll cegccthrd libstdc++ gdb
	  gdbstub docs profile all

	Done. --------------------------

1.4.1 Partial builds

You can rebuild part of CeGCC by saying e.g.

	sh build-cegcc.sh gcc
The script will then only build and install the requested module.

1.4.2 Non-standard prefix

Warning : don't install CeGCC in a generic installation directory such as /usr/local .


2. Building on Cygwin

The scripts build-cegcc.sh and build-mingw32ce.sh work on Cygwin in the same way as they do on Linux.

3 Platform independent information

3.1 How the scripts interact

3.2 Installation directory

3.3 The quick overview : how to build a cross compiler

The tools need to be built in a sequence because they rely on each other. The text below is an overview to make you understand the issues involved, the real scripts (src/build-*.sh) are the most (the only?) reliable source of information on this topic.

In this sequence, we always (configure and) build the tools, then immediately install them in $PREFIX. This is uncommon, but is the easiest way for us to deal with this sequence.

3.4 Downloading CeGCC

There are several ways to get CeGCC.

3.4.1 Get the SVN sources from our source repository

You can access our source repository directly using this command :

svn co https://cegcc.svn.sourceforge.net/svnroot/cegcc/trunk/cegcc cegcc

The result will be a large directory tree on your system; currently the size is between 800 and 900 megabytes. After compile, this becomes slightly more than 1.3 GB.

These are such large numbers for two reasons :

If you want to renew your download after a while, then all you need to do is position yourself inside the cegcc directory (inside cegcc/trunk/cegcc !) and run

svn update

3.4.2 Download a source distribution

Currently we don't offer a packaged source distribution of CeGCC. It is recommended to use subversion (SVN) to download the CeGCC sources.

The downside of distributing such a large quantity of sources would be that every version has to be downloaded completely. Use of subversion cuts a major part of the network traffic away : you can keep up to date with only a fraction of the network traffic (and the download time obviously also decreases).

4. Requirements

There is nothing out of the ordinary in the tools you need to build cegcc, most free software packages require the same :

You don't need automake, autoconf or such tools : the cegcc sources, even the ones in SVN, already contain the files generated by these tools. Note that we need to do this as some of the software that is part of cegcc requires different revisions of the auto tools than other parts of cegcc.

5. A tour of the directory structure

how to download

src The master source directory, contains the master build scripts
src/cegcc/importlibs/defs Definition files to create libraries to match WinCE DLL's
src/gcc The gcc sources
src/gdb The gdb sources
src/binutils The binutils sources (gas, ld, ..) 
src/w32api/include The target system include files
src/w32api/lib an unused part of w32api
src/build-cegcc This directory is created from the source tree
src/build-mingw32ce This directory is created from the source tree
website Our website contents are also managed via the source repository
docs The CeGCC project's documentation

6 Known problems

6.1 C++ compiler won't build

For some reason, the build process for the C++ compiler chokes. The only explanation - and workaround - that we know of is the one found in this old message saying

Configure creates a softlink in gcc object directory to the new
version of the cross assembler. Problem is that the native compiler
get confused and use the cross assembler instead of the native one.

We found that this only happens if you have the current directory in your PATH, usually in the beginning of the list (before /bin and such). A workaround is to remove . from your path, or to put it at the end.

We've adapted the build scripts so they can cope with this, but this is really a gcc bug.

6.2 Build sometimes fails

I recommend cleaning up the installation directory and all of the build directories prior to using the build scripts. The build tends to be less reliable if part of an old build is still present.




Powered by Sourceforge.net