Brendan John Simon
Mon Jul 26 07:36:00 GMT 1999

Kai Ruottu wrote:

> Brendan Simon wrote:
> > The next stage is to build a Cygwin->PowerPC cross-compiler using the
> > above cross-compiler.  I gave configure the --target=powerpc-eabi and
> > --host=i586-cygwin32 options and tried to build binutils-2.9.1.  It
> > succeeded and installed in the correct place with .exe extensions.  I
> > thought great !! but then I thought I would try to execute them on the
> > linux box and they did.  eg powerpc-eabi-ar -V gave me the version
> > number etc.
>  Are you sure you haven't equivalently named Linux binaries earlier in your
> PATH?  Using commands like './powerpc-eabi-ar.exe -V' in the directory where
> the binary is now doesn't hurt... If you leaved the '.exe' out of the
> command name, it just cannot be the right one, but a 'powerpc-eabi-ar'
> somewhere in your PATH. The '.exe' means nothing special in Linux.

Yep, I'm pretty sure I typed "./powerpc-eabi-ar.exe -V" as appossed to
"powerpc-eabi-ar -V" as I described above.

>  The Linux-command 'file' will tell the file type:
>     $ file powerpc-eabi-ar.exe

I haven't used the "file" command before.  I'll remember that in future.  I can't
check it now as I blew away the files and rebuilt them, this time specifying the
"--build=i586-linux" option.  This succeeded and the .exe files could not execute
as they were the wrong binary format.  Yipee.

# file powerpc-eabi-ar.exe
powerpc-eabi-ar.exe: MS Windows PE 32-bit Intel 80386 console executable not

Looks good to me.

>  Anyway, you MUST have the Linux-to-powerpc-eabi cross-toolset before you can
> try the Cygwin-to-powerpc-eabi. The Canadian Cross needs THREE toolsets: the
> native, for the host and for the target, all running in your Linux system...

>  The target toolset is needed to build libraries like 'libgcc.a', 'libstdc++.a'
> etc. for the target under Linux. Building them again, when you already have the
> libs with the Linux-hosted toolset is of course just a waste of time (or a
> means to check that everything seems ok -- if the generated libs are identical
> with the earlier ones...)

I was vaguely aware of this but wasn't quite sure why.  Thanks, now I understand.
As it happens, I do have a linux-to-powerpc-eabi cross-toolset installed and in my
path.  The libraries are the standard ones that come with newlib (ads and mbx).

> > I thinking setting CC_FOR_TARGET=i586-cygwin32-gcc will work.  I guess
> > all other XXX_FOR_TARGET would need to be setup correctly as well.  I
> > thought that specifying --host=i586-cygwin32 would do all this for me.
> > Any ideas what I'm doing wrong.
>  The XXX_FOR_TARGET are for the '--target=your-coming-target', just as
> the name says, the YYY_FOR_BUILD are for the '--build=your-build-host' and the
> ZZZ without no postfix are for the '--host=your-coming-host'. Telling all the
> necessary things to configure in a pre-made 'config_cygwin-to-ppc-eabi' script:
>  CC=i586-cygwin32-gcc \
>  AR=i586-cygwin32-ar \
>  RANLIB=i586-cygwin32-ranlib \
>  NM=i586-cygwin32-nm \
>  CFLAGS=-O \
>  CC_FOR_BUILD=gcc \
>  AR_FOR_BUILD=ar \
>  ...........
>  ...........
>  RANLIB_FOR_TARGET=powerpc-eabi-ranlib \
>  NM_FOR_TARGET=powerpc-eabi-nm \
>  ./configure --build=i586-linux-gnu --host=i586-cygwin32 --target=powerpc-eabi
> and using the script for the configuring doesn't hurt... It serves as a
> template for your further Canadian Crosses...

I am using a script for configuring, making and installing all my cross-compiler
ports.  It does make life much easier, especially when the process can take days
or weeks to get right (getting over the learning curve).

I'm still not sure why the XXX_FOR_BUILD, YYY_FOR_HOST and ZZZ_FOR_TARGET
variables are necessary (are they NECESSARY ?).  I'm sure that configure would
would have sorted all that out.

Anyways, I have got a bit further as I mentioned earlier (now using
--build=i586-linux").  The binutils seemed to have built and installed OK.  I have
put them in /canadian/egcs for now.  I configured egcs with exactly the same
arguments and then tried to build egcs.  It barfed some way down the track with
the following error.

i586-cygwin32-gcc -DCROSS_COMPILE -DIN_GCC    -g -O2  -DHAVE_CONFIG_H -DHAIFA  -o
collect2.exe collect2.o tlink.o hash.o \
  cplus-dem.o underscore.o version.o choose-temp.o mkstemp.o obstack.o
echo "" > tmp-runtime
echo "/* This file is automatically generated */" >objc/runtime-info.h
./cc1obj -print-objc-runtime-info tmp-runtime >>objc/runtime-info.h
/bin/sh: ./cc1obj: No such file or directory
make[1]: *** [objc/runtime-info.h] Error 126
make: *** [all-gcc] Error 2

It seems that cc1obj can not be found.  On closer inspection, the file created is
./cc1obj.exe and the Makefile is trying to execute ./cc1obj.  Is this a bug in the
configure script or Makefile ?  Or is there another configure option I must
specify ?

Brendan Simon.

New CrossGCC FAQ:
To remove yourself from the crossgcc list, send
mail to with the
text 'unsubscribe' (without the quotes) in the
body of the message.

More information about the crossgcc mailing list