Help needed building GCC for powerpc-eabi

Jeff Lasslett jeff.lasslett@datataker.com.au
Wed Aug 2 09:05:00 GMT 2006


Greetings,

I am in the process of building a GCC/binutils/newlib toolchain and libs.
The target system is a motorola powerpc (MPC850) based embedded system with
no operating system.

I have successfully compiled GCC, binutils, and newlib with
--target=powerpc-elf

If I use --target=powerpc-eabi then I have problems.  There are more details
of the hassles I'm having, but first I'll just describe how I'm going about
compiling everything.

In my $HOME directory I have created the following tree structure for compiling
the various packages:-

/home/jeff
         |
         +-gnu
         |  |
         |  +-src   <-- source tarballs (.tar.gz, .tar.bz2) extracted from here
         |  |  |
         |  |  +-binutils-2.17 <-- binutils source tree below here
         |  |  |
         |  |  +-gcc-4.1.1     <-- gcc source tree below here
         |  |  |
         |  |  +-newlib-1.14.0 <-- newlib source tree below here
         |  |
         |  +-build
         |  |  |
         |  |  +-binutils <-- binutils build process output below here
         |  |  |
         |  |  +-gcc      <-- gcc build process output below here
         |  |  |
         |  |  +-newlib   <-- newlib build process output below here


I created these variables for use in the various configure commands:-

$ export TARGET=powerpc-eabi
$ export PREFIX=/opt/crossGNU
$ export PATH=$PATH:$PREFIX/bin

I issued these commands to create the binutils.  The compile went smoothly.

$ cd ~/gnu/build/binutils
$ ../../src/binutils-2.17/configure --target=$TARGET --prefix=$PREFIX
$ make all install 2>&1 | tee make.log


I then issued the following commands to make the boostrap compiler:-

$ cd ~/gnu/build/gcc

$ ../../src/gcc-4.1.1/configure --target=$TARGET --prefix=$PREFIX \
--with-newlib --without-headers --with-gnu-as --with-gnu-ld \
--disable-shared --enable-languages=c

$ make all-gcc install-gcc 2>&1 | tee make.log

So far so good.

I next attempted to create the newlib C standard libraries.  I issued the
following commands and the process completed without error.

$ cd ~/gnu/build/newlib
$ ../../src/newlib-1.14.0/configure --target=$TARGET --prefix=$PREFIX
$ make all install 2>&1 | tee make.log

Next is what I issued to create the final GCC ...

$ cd ~/gnu/build/gcc

$ rm -rf *

$ ../../src/gcc-4.1.1/configure --target=$TARGET --prefix=$PREFIX \
--with-gnu-as --with-gnu-ld --with-newlib --enable-languages=c,c++

$ make all install 2>&1 | tee make.log

If $TARGET equals powerpc-elf then everything is fine and I get my compiler, libs
and tools.  If $TARGET equals powerpc-eabi then this last build fails.

This is what I see in my terminal window:-

checking for ISO C99 support in <wchar.h>... no
checking for fully enabled ISO C99 support... no
configure: Debug build flags set to -g3 -O0
checking for additional debug build... no
checking for extra compiler flags for building...
checking for thread model used by GCC... single
checking for shared libgcc... configure: error: Link tests are not allowed 
after GCC_NO_EXECUTABLES.
make[1]: *** [configure-target-libstdc++-v3] Error 1
make[1]: Leaving directory `/home/jeff/gnu/build/gcc'
make: *** [all] Error 2


SO I looked in the
/home/jeff/gnu/build/gcc/powerpc-eabi/libstdc++-v3/config.log
file and found several instances of the following:-

/opt/crossgnu/bin/powerpc-eabi-ld: warning: cannot find entry symbol _start; 
defaulting to 01800074
/home/jeff/gnu/build/gcc/./gcc/libgcc.a(eabi.o): In function `__eabi':
/home/jeff/gnu/build/gcc/gcc/eabi.S:232: undefined reference to `__init'
/home/jeff/gnu/build/gcc/./gcc/libgcc.a(eabi.o):(.got2+0x8): undefined 
reference to `__SDATA_START__'
/home/jeff/gnu/build/gcc/./gcc/libgcc.a(eabi.o):(.got2+0xc): undefined 
reference to `__SBSS_END__'
/home/jeff/gnu/build/gcc/./gcc/libgcc.a(eabi.o):(.got2+0x14): undefined 
reference to `__SDATA2_START__'
/home/jeff/gnu/build/gcc/./gcc/libgcc.a(eabi.o):(.got2+0x18): undefined 
reference to `__SBSS2_END__'
/home/jeff/gnu/build/gcc/./gcc/libgcc.a(eabi.o):(.got2+0x1c): undefined 
reference to `__GOT_START__'
/home/jeff/gnu/build/gcc/./gcc/libgcc.a(eabi.o):(.got2+0x28): undefined 
reference to `__GOT_END__'
/home/jeff/gnu/build/gcc/./gcc/libgcc.a(eabi.o):(.got2+0x2c): undefined 
reference to `__GOT2_START__'
/home/jeff/gnu/build/gcc/./gcc/libgcc.a(eabi.o):(.got2+0x30): undefined 
reference to `__GOT2_END__'
/home/jeff/gnu/build/gcc/./gcc/libgcc.a(eabi.o):(.got2+0x34): undefined 
reference to `__FIXUP_START__'
/home/jeff/gnu/build/gcc/./gcc/libgcc.a(eabi.o):(.got2+0x38): undefined 
reference to `__FIXUP_END__'
/home/jeff/gnu/build/gcc/./gcc/libgcc.a(eabi.o):(.got2+0x3c): undefined 
reference to `__CTOR_LIST__'
/home/jeff/gnu/build/gcc/./gcc/libgcc.a(eabi.o):(.got2+0x40): undefined 
reference to `__CTOR_END__'
/home/jeff/gnu/build/gcc/./gcc/libgcc.a(eabi.o):(.got2+0x44): undefined 
reference to `__DTOR_LIST__'
/home/jeff/gnu/build/gcc/./gcc/libgcc.a(eabi.o):(.got2+0x48): undefined 
reference to `__DTOR_END__'
/home/jeff/gnu/build/gcc/./gcc/libgcc.a(eabi.o):(.got2+0x4c): undefined 
reference to `__EXCEPT_START__'
/home/jeff/gnu/build/gcc/./gcc/libgcc.a(eabi.o):(.got2+0x50): undefined 
reference to `__EXCEPT_END__'
collect2: ld returned 1 exit status
 
                                                                377,35        22%

It would seem that some file must be linked against but it doesn't exist, or
isn't where it's supposed to be, or there's an argument missing somewhere.

I would appreciate it greatly if someone could please shed some light on this
problem for me.

I'd like to figure out how to get GCC to compile/link in the source tree
config described above.  That said, I am happy to try a combined tree build.

would building everything in a combined tree help?

Can I do that with the sources that I've downloaded?  If so, how do I construct
the combined tree?


Thanks,
         Jeff Lasslett

PS:  I have searched a bit in the gcc-help mailing list archives with limited
      success.  I found the following ...

      http://gcc.gnu.org/ml/gcc-help/2006-04/msg00141.html

      ... but it doesn't seem to contain the answer to my problem.













More information about the Gcc-help mailing list