This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc-2.95.3 for powerpc-linux


"Xiaogeng (Shawn) Jin" wrote:
> 
> Hi,
> 
> I encountered some errors when building a cross compiler for
> powerpc-linux target on an i686-linux host (RedHat 7.2). I use
> gcc-2.95.3, binutils-2.11.2, and glibc-2.2.5. Everything seems OK except
> when I verify the glibc using "make check".
> 
> The following shows what I did step by step. Anybody had similar
> problems before? Any suggestion or hint to solve the problem? Thank you
> very much.
> 
> TARGET=powerpc-linux
> PREFIX=/opt/xdev/ppc
> 
> 1. binutils
> ../binutils-2.11.2/configure --host=i686-pc-linux-gnu
> --target=powerpc-linux --prefix=/opt/xdev/ppc --norecursion
> 
> make all install

 OK

> 
> 2. bootstrap gcc
> ../gcc-2.95.3/configure
> --with-gcc-version-trigger=/u/xjin/code/gcc-2.95.3/gcc/version.c
> --host=i686-pc-linux-gnu --target=powerpc-linux --prefix=/opt/xdev/ppc
> --with-gnu-as --with-gnu-ld --enable-languages=c --disable-shared
> --without-headers --with-newlib --program-prefix=powerpc-linux-
> --norecursion
> 
> make all-gcc install-gcc

 If you used the newlib-headers here, the produced 'libgcc'-stuff is
only garbage...
 
> 3. glibc
> ../glibc-2.2.5/configure  --host=powerpc-linux --enable-add-ons
> --prefix=/opt/xdev/ppc
> --with-headers=/opt/xdev/ppc/powerpc-linux/include
> --program-prefix=powerpc-linux-

 Building glibc needs working 'libgcc'-stuff, so you most probably got
garbage even here...
 
> It seems fine at this step. But when the glibc is check, it shows the
> following errors.
> 
> make  -C stdlib tests
> make[2]: Entering directory `/u/xjin/code/glibc-2.2.5/stdlib'
> cd /u/xjin/code/b3-libc/stdlib && powerpc-linux-gcc -O  -include
> ../config.h /u/xjin/code/glibc-2.2.5/stdlib/isomac.c -o isomac
> /u/xjin/code/glibc-2.2.5/stdlib/isomac.c:74: stdio.h: No such file or
> directory
> /u/xjin/code/glibc-2.2.5/stdlib/isomac.c:75: stdlib.h: No such file or
> directory
> /u/xjin/code/glibc-2.2.5/stdlib/isomac.c:76: string.h: No such file or
> directory

 It tries to use the installed glibc-headers, the 'powerpc-linux-gcc'
with the given options cannot find anything else...

> The INSTALL instructions coming with glibc-2.2.5 warn that installing a
> glibc doesn't pass the verfication is dangerous. But in order to
> continue my work, I just installed the glibc. The I went to the last
> step to build a complete cross GCC.
> 
> 4. complete cross gcc
> ../gcc-2.95.3/configure
> --with-gcc-version-trigger=/u/xjin/code/gcc-2.95.3/gcc/version.c
> --host=i686-pc-linux-gnu --target=powerpc-linux --prefix=/opt/xdev/ppc
> --enable-shared --enable-threads --with-gnu-as --with-gnu-ld
> --enable-languages=c --norecursion

 The '--prefix=' in the GCC-build means a different thing than the same
option in the glibc-build... While the value in GCC- and binutils-builds
must be the same, it must be different in the glibc-build, ie. :

   $prefix_glibc = $prefix_gcc/$target

and you should have used a '--prefix=/opt/xdev/ppc/powerpc-linux' in the
glibc-configure... Now your glibc has been installed under '/opt/xdev/ppc'
('include', 'lib', 'share', 'sbin', 'libexec',...), not where GCC expects
it being.

> make GCC_FOR_TARGET="/u/xjin/code/b3a-gcc/gcc/xgcc
> -B/u/xjin/code/b3a-gcc/gcc/ -B/opt/xdev/ppc/powerpc-linux/bin/
> -I/opt/xdev/ppc/powerpc-linux/include" \
    ***********************************

 Here it tells where the 'powerpc-linux' headers are expected to be...

> ../../gcc-2.95.3/gcc/libgcc2.c:41: stdlib.h: No such file or directory
> ../../gcc-2.95.3/gcc/libgcc2.c:42: unistd.h: No such file or directory

but they simply aren't there...

 As told in my 'preach' in another message, preinstalling a working glibc
is the recommended way, and should be the most common method too. Building
from scratch needs quite a lot know-how about how glibc and GCC work. If
not being worked with them for years, only garbage may be produced, the old
'GIGO' ('Garbage In - Garbage Out') rule should be known... When the GCC-
build expects a working C-library (this meaning 'any' working...) and the
glibc-build expects a working GCC with a working 'libgcc'-stuff, the build
from scratch really requires the builder knowing what one is doing... So,
"Don't try to build a car until you have heard someone talking about tires,
a motor, gasoline etc. being necessary for it, otherwise it will not run"...

 It can be that one doesn't know that 20 litres gasoline put into some big
bottle inside the car isn't enough for the motor to find it (it should be
put into the tank...). Quite the same thing is not knowing where GCC tries
to find its headers, so putting them 'somewhere' may be the result...

 Please try the following:

    powerpc-linux-gcc --help
and
    powerpc-linux-gcc -print-search-dirs

and please get the GCC-manual by building it from the '.texinfo' sources
or downloading it from 'ftp.redhat.com/products/support/manuals' (in PDF)
or somewhere...

 And, there are quite a lot Linux/PPC-distributions where tested and
production-grade glibcs should be...

Cheers, Kai


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]