Cross-Compiling gcc 3.2.3 for arm-elf : the good version

Vincent Rubiolo vincent.rubiolo@free.fr
Thu May 15 12:50:00 GMT 2003


Here is the good version, sorry for the duplicates!(pbs with the web interface 
for my mails)

Hello Daniel!

I finally achieved the whole build process with interworking and c++ enabled 
for arm-elf following Richard Earnshaw instructions (found here 
: http://sources.redhat.com/ml/crossgcc/2002-01/msg00139.html).

The build succeeded but I didn't run any dejagnu testsuite on it yet.

Several things (I place them here so that if somebody makes a research into the 
ml archives, this may be useful) :

1. When working under Cygwin envt, DO NOT unpack your tarballs with Winzip 
unless you unchecked the "TAR file CR/LF smart handling" in the options. This is 
very important if you don't want to have you source full of endline backslashes 
and a build that fails (my very first attempt might have failed because of this)

2. I still cannot figure why but Bill's instructions didn't make the thing 
compile (retried from scratch this morning, failed when building the c++ libs).

If I try to sum up the whole thing :
Bill's script enables c only at the beginning, puts --without-headers and 
--with-newlib in the cfg line along the others options and goes for make all-gcc 
install-gcc. After that, builds newlib and then reconfigure gcc with c and c++ 
enabled. It fails for me at the second step (complete gcc build) when dealing 
with libstdc++.

Instead, I achieved it with (thanks again Richard):
One-pass gcc config : enabling languages=c,c++, 
--with-headers=newlib-dir/newlib/libc/include --with-newlib --disable-share 
--disable-threads
make all-gcc install-gcc
configuring and building newlib
return to the gcc dir and finish the stuff : make all install (but no 2nd 
configure)

Please also note that the cfg script says "Copying 
../../src/newlib-1.11.0/newlib/libc/include/ to 
/cygdrive/c/GNU/Scratch/Build/arm-elf/sys-include" when you put 
--with-headers=... in the cfg line. The gcc configuration page also says that 
the option --with-headers _MUST_ be used when cross-compiling. If you put 
--without-headers you get "Can't copy no to 
/cygdrive/c/GNU/Scratch/Build/arm-elf/sys-include")

It then takes ages to build (3:30 to 4 hrs on my 700 Mhz P4) but succeeds !

This all assume that gcc src is patched (as of 3.2.3) to enable interworking 
(t-arm-elf) and to correct the bug with __mempcpy (your setting in Bill's script 
may be as good, I didn't try it. I personnally patched gnuregex.c and the other 
files in the fixinc dir. The instructions are here : 
http://gcc.gnu.org/cgi-bin/gnatsweb.pl, the fix will be included in 3.3). 
Binutils and gdb built just fine.

Comments appreciated, especially on the two stages configure (I suppose it is 
just to enable c++ on stage 2...)

That's it, quite a long mail but i hope it'll be useful for somebody.

Once again a big thank to you Daniel !

Best regards,

Vincent


Follows here the script I used (very simple, I just comment out the lines I 
don't want each time I build)

#!/bin/bash

export TARGET=arm-elf
export PREFIX=/cygdrive/c/GNU/Scratch/Build
export PATH=$PATH:$PREFIX/bin

mkdir Build
mkdir build-binutils
mkdir build-gcc
mkdir build-newlib
mkdir build-gdb

tar xzf binutils-2.13.2.tar.gz
cd build-binutils
../../src/binutils-2.13.2/configure --target=$TARGET --prefix=$PREFIX 2>&1 |tee 
configure.log
make all install 2>&1 |tee make-install.log
cd ..

tar xzf gcc-3.2.3.tar.gz
cd build-gcc
../../src/gcc-3.2.3/configure --prefix=$PREFIX --target=$TARGET 
--disable-threads \
--with-newlib --disable-shared --enable-langages=c,c++ 
--with-headers=../../src/newlib-1.11.0/newlib/libc/include/ \
2>&1 |tee configure-core.log
make all-gcc install-gcc 2>&1 |tee make-install-core.log
cd ..

tar xzf newlib-1.11.0.tar.gz
cd build-newlib
../../src/newlib-1.11.0/configure --target=$TARGET --prefix=$PREFIX 2>&1 |tee 
configure.log
make all install 2>&1 |tee make-install.log
cd ..

cd build-gcc
make all install 2>&1 |tee make-install-complete.log
cd ..

tar xzf gdb-5.3.tar.gz
cd build-gdb
../../src/gdb-5.3/configure --target=$TARGET --prefix=$PREFIX 2>&1 |tee 
configure.log
make all install 2>&1 |tee make-install.log
cd ..

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list