Please help me

Dave Korn dave.korn@artimi.com
Tue Jan 31 15:36:00 GMT 2006


On 31 January 2006 15:14, Dan Kegel wrote:

> On 1/31/06, Sanjeev Rao <sr_sanjeev@yahoo.!> wrote:
>> I have been follwing the procedure given
>> "GCC_crosscompiler_buildprocess.txt" to build cross compiler for power
>> pc.

>> cc1: invalid option `powerpc'
>> cc1: invalid option `new-mnemonics'
> 
> That sounds like it's invoking the wrong compiler.

  Absolutely, it's getting the host-native gcc instead of the freshly-built minimal crossgcc.

> Try invoking the minimal compiler directly rather than using the system
> compiler's -B option, maybe. - Dan

  He's not "using the system compiler's -B option" - it was glibc configure that chose to do things that way.  I'm not 100% on this
but I have a theory:

> ../glibc-2.3/configure
> --prefix=/opt/crossgcc/powerpc-linux
> --target=powerpc-linux --host=powerpc-linux --enable-add-ons=linuxthreads
> --with-headers=/usr/src/linux-2.4.20-8/include/ 
> --with-binutils=/opt/crossgcc/powerpc-linux/powerpc-linux/bin

  I think that it's invoked the host native compiler because it was unable to find the cross compiler, which is because it doesn't
know where to look to find the cross gcc, which is because CROSS_COMPILE isn't set, which in turn is because $host==$target in the
configure line above.

  Sanjeev, you have to get your head around the way that --host= and --target= work.  The --host is the machine on which the
complete program is going to execute when it's built.  For the cross-compiler, that's your x86 linux machine.  The --target is the
machine which the program, when built, will generate valid output for.  For the cross compiler, it targets powerpc.

  Now it's natural to think that if you have a compiler that targets powerpc, you need a glibc that targets powerpc as well.  But
it's not right!  The glibc code is native power pc code.  It doesn't generate output for a target: it runs directly on a powerpc
machine itself.  So, for glibc, --host is the machine that you would have used for --target when you built gcc!  That's because gcc
builds code _for_ the powerpc, but glibc _is_ code for the powerpc.

  So, the probable answer is that you want to remove the --target option from that configure line.  You only ever needed the --host
option there, and the --host doesn't have to be the same as the --build machine, and in that case (which is the case here because
you're building on an x86 linux but the code is going to be hosted on ppc linux) the configure script knows that it needs to locate
and use a cross compiler.  (When you have build==host, it thinks no cross-compile is going on, and configure gets confused).


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


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



More information about the crossgcc mailing list