[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.6.2 Building a Cross Program

There are additional considerations if you want to build a cross compiler, rather than a native compiler, in the Cygnus tree using a Canadian Cross.

When you build a cross compiler using the Cygnus tree, then the target libraries will normally be built with the newly built target compiler (see section 5.6.1 Host and Target Libraries). However, this will not work when building with a Canadian Cross. This is because the newly built target compiler will be a program which runs on the host system, and therefore will not be able to run on the build system.

Therefore, when building a cross compiler with the Cygnus tree, you must first install a set of build cross target tools. These tools will be used when building the target libraries.

Note that this is not a requirement of a Canadian Cross in general. For example, it would be possible to build just the host cross target tools on the build system, to copy the tools to the host system, and to build the target libraries on the host system. The requirement for build cross target tools is imposed by the Cygnus tree, which expects to be able to build both host programs and target libraries in a single `configure'/`make' step. Because it builds these in a single step, it expects to be able to build the target libraries on the build system, which means that it must use a build cross target toolchain.

For example, suppose you want to build a Windows cross MIPS ELF compiler on a GNU/Linux system. You must have previously installed both a GNU/Linux cross Windows compiler and a GNU/Linux cross MIPS ELF compiler.

In order to build the Windows (configuration name `i386-cygwin32') cross MIPS ELF (configure name `mips-elf') compiler, you might execute the following commands (long command lines are broken across lines with a trailing backslash as a continuation character).

 
mkdir linux-x-cygwin32
cd linux-x-cygwin32
srcdir/configure --target i386-cygwin32 --prefix=installdir \
  --exec-prefix=installdir/H-i386-linux
make
make install
cd ..
mkdir linux-x-mips-elf
cd linux-x-mips-elf
srcdir/configure --target mips-elf --prefix=installdir \
  --exec-prefix=installdir/H-i386-linux
make
make install
cd ..
mkdir cygwin32-x-mips-elf
cd cygwin32-x-mips-elf
srcdir/configure --build=i386-linux-gnu --host=i386-cygwin32 \
  --target=mips-elf --prefix=wininstalldir \
  --exec-prefix=wininstalldir/H-i386-cygwin32
make
make install

You would then copy the contents of wininstalldir over to the Windows machine, and run the resulting programs.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by system on December, 2 2004 using texi2html