build cross gcc for ppc with glibc

Schlomo Schapiro schapiro@mobileye.com
Mon Jan 28 09:55:00 GMT 2002


Hi,

thanks for the link. I also found this link:
http://penguinppc.org/embedded/cross-compiling/
which has very similar instructions.

I am using --prefix=/opt/Altivec --target=powerpc-linux --host=i686-linux
to compile everything. And I of course put the /opt/Altivec/bin and
/opt/Altivec/powerpc-linux/bin dirs into the path.

Binutils compiles without any appearent problem, though there are some
warnings which make me wonder wether binutils are broken even though they
build and install seemingly well:

/bin/sh ../../../binutils-2.9.5.0.12/ld/genscripts.sh
../../../binutils-2.9.5.0.12/ld /opt/Altivec/lib i686-pc-linux-gnu
powerpc-unknown-linux-gnu powerpc-linux "elf32ppclinux elf32ppc" ""
elf32ppc "powerpc-linux"
sed: Couldn't open file stringify.sed
sed: Couldn't open file stringify.sed
sed: Couldn't open file stringify.sed
sed: Couldn't open file stringify.sed
sed: Couldn't open file stringify.sed
sed: Couldn't open file stringify.sed
gcc -DHAVE_CONFIG_H -I. -I../../../binutils-2.9.5.0.12/ld -I.
-D_GNU_SOURCE -I. -I../../../binutils-2.9.5.0.12/ld -I../bfd
-I../../../binutils-2.9.5.0.12/ld/../bfd
-I../../../binutils-2.9.5.0.12/ld/../include
-I../../../binutils-2.9.5.0.12/ld/../intl -I../intl  -g -O2 -W -Wall
-DLOCALEDIR="\"/opt/Altivec/share/locale\""    -g -O2 -W -Wall -c
eelf32ppc.c
eelf32ppc.c: In function `gldelf32ppc_get_script':
eelf32ppc.c:941: warning: `return' with no value, in function returning
non-void
eelf32ppc.c:942: warning: `return' with no value, in function returning
non-void
eelf32ppc.c:943: warning: `return' with no value, in function returning
non-void
eelf32ppc.c:944: warning: `return' with no value, in function returning
non-void
eelf32ppc.c:945: warning: `return' with no value, in function returning
non-void
eelf32ppc.c:946: warning: `return' with no value, in function returning
non-void
eelf32ppc.c:961: warning: this function may return with or without a value


It still doesn't work, though, and I have some more questions:
1) Does the --with-newlib option to configure for gcc not imply that I
will later install newlib ? I have to use glibc

2) I have to use gcc-2.95.2 because I need to apply the Altivec patches
for the G4 CPU. However --without-headers seems to be without any
function. Only with --with-newlib does the make all-gcc not fail on
stdlib.h. Is --without-headers a specific gcc-2.95.3 feature ? Is 2.95.3
somehow better that 2.95.2 with regard to cross-compiling ?

3) In the end I managed to build the bootsrap gcc, but glibc won't
compile. First it complains about some errors in vfprintf.c:

make[2]: Entering directory `/home/work/Altivec/glibc-2.2/stdio-common'
gcc vfprintf.c -c -O -Wall -Winline -Wstrict-prototypes -Wwrite-strings -g
-mnew-mnemonics -Wa,-mppc -mpowerpc   -Wno-uninitialized   -I../include
-I. -I/home/work/Altivec/build/glibc/stdio-common -I.. -I../libio
-I/home/work/Altivec/build/glibc -I../sysdeps/powerpc/elf
-I../linuxthreads/sysdeps/unix/sysv/linux
-I../linuxthreads/sysdeps/pthread -I../linuxthreads/sysdeps/unix/sysv
-I../linuxthreads/sysdeps/unix -I../linuxthreads/sysdeps/powerpc
-I../sysdeps/unix/sysv/linux/powerpc -I../sysdeps/unix/sysv/linux
-I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman
-I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix/powerpc
-I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/powerpc/fpu
-I../sysdeps/powerpc -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/flt-32
-I../sysdeps/ieee754/dbl-64 -I../sysdeps/powerpc/soft-fp
-I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic
-D_LIBC_REENTRANT -include ../include/libc-symbols.h     -D_IO_MTSAFE_IO
-o /home/work/Altivec/build/glibc/stdio-common/vfprintf.o
vfprintf.c: In function `_IO_vfprintf':
vfprintf.c:1527: field `extra' already initialized
vfprintf.c:1527: warning: excess elements in struct initializer
vfprintf.c:1527: warning: (near initialization for `info')
vfprintf.c:1527: field `wide' already initialized
vfprintf.c:1527: warning: excess elements in struct initializer
vfprintf.c:1527: warning: (near initialization for `info')
vfprintf.c:1527: field `extra' already initialized
vfprintf.c:1527: warning: excess elements in struct initializer
vfprintf.c:1527: warning: (near initialization for `info')
vfprintf.c:1527: field `wide' already initialized
vfprintf.c:1527: warning: excess elements in struct initializer
vfprintf.c:1527: warning: (near initialization for `info')

I commented out the offending lines and then the compilation broke like this:

make[2]: Entering directory `/home/work/Altivec/glibc-2.2/iconv'
gcc -nostdlib -nostartfiles -o
/home/work/Altivec/build/glibc/iconv/iconv_prog
-Wl,-dynamic-linker=/opt/Altivec/lib/ld.so.1
/home/work/Altivec/build/glibc/csu/crt1.o
/home/work/Altivec/build/glibc/csu/crti.o `gcc
--print-file-name=crtbegin.o`
/home/work/Altivec/build/glibc/iconv/iconv_prog.o
-Wl,-rpath-link=/home/work/Altivec/build/glibc:/home/work/Altivec/build/glibc/math:/home/work/Altivec/build/glibc/elf:/home/work/Altivec/build/glibc/dlfcn:/home/work/Altivec/build/glibc/nss:/home/work/Altivec/build/glibc/nis:/home/work/Altivec/build/glibc/rt:/home/work/Altivec/build/glibc/resolv:/home/work/Altivec/build/glibc/crypt:/home/work/Altivec/build/glibc/linuxthreads
/home/work/Altivec/build/glibc/libc.so.6
/home/work/Altivec/build/glibc/libc_nonshared.a -lgcc `gcc
--print-file-name=crtend.o` /home/work/Altivec/build/glibc/csu/crtn.o
/home/work/Altivec/build/glibc/elf/ld.so.1: undefined reference to `_end'
/opt/Altivec/powerpc-linux/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make[2]: *** [/home/work/Altivec/build/glibc/iconv/iconv_prog] Error 1
make[2]: Leaving directory `/home/work/Altivec/glibc-2.2/iconv'
make[1]: *** [iconv/others] Error 2
make[1]: Leaving directory `/home/work/Altivec/glibc-2.2'
make: *** [all] Error 2

Now this seems to be related to the fact that there is no libc installed
YET (maybe gcc assumes I would install newlib ??).

So I am back to the chicken-egg problem !

This bootstrap gcc doesn't even compile an empty program like
"int main() {};". It also fails on

/opt/Altivec/powerpc-linux/bin/ld: cannot open crt1.o:

Please help, I am quite desparate about this now because I need to create
the toolchain ...

Thank you very much,
Schlomo

On Fri, 25 Jan 2002, Vermeulen Jan wrote:

> Hello,
>
>
> > I need to build a cross-gcc to compile PPC stuff on a i386 box (with
> > Altivec extensions).
> >
> > The problem is that the compilation of gcc (make bootstrap) ends with
> > this:
> > -------------------------------------------
> [snip]
> > as: unrecognized option `-ppc'
> > make[3]: *** [libgcc2.a] Error 1
> > make[3]: Leaving directory
> > `/home/mobileye/work/Altivec/gcc-2.95.2.orig/gcc-2.95.2/build/gcc'
> > make[2]: *** [stmp-multilib-sub] Error 2
> > make[2]: Leaving directory
> > `/home/mobileye/work/Altivec/gcc-2.95.2.orig/gcc-2.95.2/build/gcc'
> > make[1]: *** [stmp-multilib] Error 1
> > make[1]: Leaving directory
> > `/home/mobileye/work/Altivec/gcc-2.95.2.orig/gcc-2.95.2/build/gcc'
> > make: *** [bootstrap] Error 2
> > ------------------------------------------------------------------
> >
> > The as called here is the one from the cross-binutils which I
> > successfully
> > installed previously. I also installed a glibc into the same prefix
> > (--prefix=/usr/mobileye/Altivec).
>
> Have you put this prefix (more exactly the ${prefix}/bin) in your path ?
>
> And what are the commandline options you use for 'configure' ?
>
> > PS: I don't want to build with newlib, however, I didn't find
> > any howto or
> > FAQ how to properly build binutils/gcc/glibc for a cross
> > encironment from
> > scratch.
>
> Try http://crossgcc.billgatliff.com
>
> I hope it helps you out. Let us know.
>
> Best regards,
> Jan
>
>

-- 
Schlomo Schapiro
Senior System Administrator
MobilEye Vision Technologies Ltd.

24 Mishol Hadkalim St.,97278 Jerusalem, Israel
Telephone:  + 972-2-586-6989 Ext. 131
Mobile:     + 972-55-767898
Fax:        + 972-2-586-7720

email: schapiro@mobileye.com
WWW:   http://www.mobileye.com




------
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