public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* FW: Need help in building a PowerPC cross compiler
@ 2004-09-08 18:37 Wong, John
  0 siblings, 0 replies; only message in thread
From: Wong, John @ 2004-09-08 18:37 UTC (permalink / raw)
  To: gcc-help; +Cc: Wong, John


Hi,

I'm having a lot of problems building a cross compiler with the gcc 3.4.1 source.  Can someone help me out?  I have to build a cross assembler using binutils.  I have done so.  But it's the fine details of when to use it and how that's escaping me.

My host system is -host=i686-pc-linux-gnu (and intel pc running linux) and my target system is -target=power-*-eabi (embedded PowerPC, big endian).

Searching through the web, I know I have to also generate a cross assembler from the binutils source; building with the same target (--target=power-*-eabi).   I have done so, but I still don't know when and how to use this cross assembler as(1).  /usr/bin/as makes i686-pc-linux-gnu machine code.  /usr/local/binutils/powerpc-*-eabi/bin/as makes powerpc-*-eabi code.




When I first build gcc, I use the bundled Red-Hat gcc that generates a i686-linux target.  But I get an error with as(1).

make[2]: Entering directory `/home/jwong/gcc-build/gcc-3.4.1-objdir/gcc'
for d in libgcc nof libgcc/nof le libgcc/le und libgcc/und le/und libgcc/le/und nof/le libgcc/nof/le nof/und libgcc/nof/und nof/le/und libgcc/nof/le/und; do \
  if [ -d $d ]; then true; else /bin/sh ../../gcc-3.4.1/gcc/mkinstalldirs $d; fi; \
done
if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi
/home/jwong/gcc-build/gcc-3.4.1-objdir/gcc/xgcc -B/home/jwong/gcc-build/gcc-3.4.1-objdir/gcc/ -B/usr/local/gcc/341/powerpc-*-eabi/bin/ -B/usr/local/gcc/341/powerpc-*-eabi/lib/ -isystem /usr/local/gcc/341/powerpc-*-eabi/include -isystem /usr/local/gcc/341/powerpc-*-eabi/sys-include -O2  -DIN_GCC -DCROSS_COMPILE   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -g  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I. -I -I../../gcc-3.4.1/gcc -I../../gcc-3.4.1/gcc/ -I../../gcc-3.4.1/gcc/../include   -mrelocatable-lib -mno-eabi -mstrict-align -DL_muldi3 -c ../../gcc-3.4.1/gcc/libgcc2.c -o libgcc/./_muldi3.o
as: unrecognized option `-mppc'
make[2]: *** [libgcc/./_muldi3.o] Error 1
make[2]: Leaving directory `/home/jwong/gcc-build/gcc-3.4.1-objdir/gcc'
make[1]: *** [stmp-multilib] Error 2
make[1]: Leaving directory `/home/jwong/gcc-build/gcc-3.4.1-objdir/gcc'
make: *** [all-gcc] Error 2


According to the web, I need a cross assembler for the -target=powerpc-*-eabi architecture.  So I get binutils 2.14 and compile it with -target=powerpc-*-eabi, -enable-targets=all, and -prefix=/usr/local/binutils (the install location).  Binutils compiles successfully.

Now I try to point make(1) to use this by editing the top level Makefile.  There is AS = directive.  I change it to
AS = /usr/local/binutils/powerpc-*-eabi/bin/as.
I re-issue the make command.  I get the same error as above.  It seems make(1) is ignoring it.

So I replace /usr/bin/as with one that is a symbolic like to /usr/local/binutils/powerpc-*-eabi/bin/as.  I reissue the make command.  Make complains that it cannot find powerpc-*-eabi-ar.  Ok, I add /usr/local/binutils/bin to the end of my path.  I re-issue the make command.  Here's the new error:


make[2]: Entering directory `/home/jwong/gcc-build/gcc-3.4.1-objdir/gcc'
for d in libgcc nof libgcc/nof le libgcc/le und libgcc/und le/und libgcc/le/und nof/le libgcc/nof/le nof/und libgcc/nof/und nof/le/und libgcc/nof/le/und; do \
  if [ -d $d ]; then true; else /bin/sh ../../gcc-3.4.1/gcc/mkinstalldirs $d; fi; \
done
if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi
make[2]: Leaving directory `/home/jwong/gcc-build/gcc-3.4.1-objdir/gcc'
echo timestamp > stmp-multilib
if [ -f gnatbind ] ; \
then \
  mv gnatbind  gnatbind-cross; \
fi
if [ -f gnatbl ] ; \
then \
  mv gnatbl    gnatbl-cross; \
fi

. . .

if [ -f gpr2make ] ; \
then \
   mv gpr2make  gpr2make-cross; \
fi
if [ -f gprcmd ] ; \
then \
   mv gprcmd  gprcmd-cross; \
fi
(SHLIB_LINK='' \
SHLIB_MULTILIB=''; \
gcc -c   -g -O2 -DIN_GCC -DCROSS_COMPILE  -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long    -DHAVE_CONFIG_H    -DSTANDARD_STARTFILE_PREFIX=\"../../../\" -DSTANDARD_EXEC_PREFIX=\"/usr/local/gcc/341/lib/gcc/\" -DSTANDARD_LIBEXEC_PREFIX=\"/usr/local/gcc/341/libexec/gcc/\" -DDEFAULT_TARGET_VERSION=\"3.4.1\" -DDEFAULT_TARGET_MACHINE=\"powerpc-*-eabi\" -DSTANDARD_BINDIR_PREFIX=\"/usr/local/gcc/341/bin/\" -DTOOLDIR_BASE_PREFIX=\"../../../../\"  `test "X${SHLIB_LINK}" = "X" || test "yes" != "yes" || echo "-DENABLE_SHARED_LIBGCC"` `test "X${SHLIB_MULTILIB}" = "X" || echo "-DNO_SHARED_LIBGCC_MULTILIB"` \
      -I. -I. -I../../gcc-3.4.1/gcc -I../../gcc-3.4.1/gcc/. -I../../gcc-3.4.1/gcc/../include  ../../gcc-3.4.1/gcc/cp/g++spec.c)
/tmp/ccOPiLy9.s: Assembler messages:
/tmp/ccOPiLy9.s:146: Error: Unrecognized opcode: `pushl'
/tmp/ccOPiLy9.s:148: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:150: Error: Unrecognized opcode: `pushl'
/tmp/ccOPiLy9.s:152: Error: Unrecognized opcode: `pushl'
/tmp/ccOPiLy9.s:154: Error: Unrecognized opcode: `pushl'
/tmp/ccOPiLy9.s:156: Error: Unrecognized opcode: `subl'
/tmp/ccOPiLy9.s:158: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:159: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:160: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:163: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:165: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:167: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:169: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:171: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:173: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:174: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:176: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:178: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:180: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:182: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:184: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:186: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:188: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:190: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:192: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:194: Error: Unrecognized opcode: `pushl'
/tmp/ccOPiLy9.s:195: Error: Unrecognized opcode: `pushl'
/tmp/ccOPiLy9.s:197: Error: Unrecognized opcode: `call'
/tmp/ccOPiLy9.s:199: Error: Unrecognized opcode: `addl'
/tmp/ccOPiLy9.s:200: Error: Unrecognized opcode: `decl'
/tmp/ccOPiLy9.s:202: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:204: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:205: Error: Unrecognized opcode: `jle'
/tmp/ccOPiLy9.s:209: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:210: Error: Unrecognized opcode: `testl'
/tmp/ccOPiLy9.s:211: Error: Unrecognized opcode: `je'
/tmp/ccOPiLy9.s:213: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:216: Error: Unrecognized opcode: `incl'
/tmp/ccOPiLy9.s:217: Error: Unrecognized opcode: `movl'
/tmp/ccOPiLy9.s:218: Error: bad expression

. . .

/tmp/ccOPiLy9.s:9980: Error: unknown pseudo-op: `.value'
/tmp/ccOPiLy9.s:9984: Error: unknown pseudo-op: `.value'
/tmp/ccOPiLy9.s:9985: Error: unknown pseudo-op: `.value'
make[1]: *** [g++spec.o] Error 1
make[1]: Leaving directory `/home/jwong/gcc-build/gcc-3.4.1-objdir/gcc'
make: *** [all-gcc] Error 2


=========================================================================


Now, I do a make clean.  Then a make.  Make fails much sooner now.


make[1]: Entering directory `/home/jwong/gcc-build/gcc-3.4.1-objdir/libiberty'
if [ x"" != x ] && [ ! -d pic ]; then \
  mkdir pic; \
else true; fi
touch stamp-picdir
CONFIG_FILES= CONFIG_HEADERS=config.h:config.in /bin/sh ./config.status
config.status: creating config.h
config.status: executing default commands
if [ x"" != x ]; then \
  gcc -c -DHAVE_CONFIG_H -g -O2 -I. -I../../gcc-3.4.1/libiberty/../include  -W -Wall -Wtraditional -pedantic  ../../gcc-3.4.1/libiberty/regex.c -o pic/regex.o; \
else true; fi
gcc -c -DHAVE_CONFIG_H -g -O2 -I. -I../../gcc-3.4.1/libiberty/../include  -W -Wall -Wtraditional -pedantic ../../gcc-3.4.1/libiberty/regex.c -o regex.o
In file included from ../../gcc-3.4.1/include/xregex.h:26,
                 from ../../gcc-3.4.1/libiberty/regex.c:195:
../../gcc-3.4.1/include/xregex2.h:551: warning: ISO C89 does not support `static' or type qualifiers in parameter array declarators
In file included from ../../gcc-3.4.1/libiberty/regex.c:649:
../../gcc-3.4.1/libiberty/regex.c: In function `byte_compile_range':
../../gcc-3.4.1/libiberty/regex.c:4548: warning: signed and unsigned type in conditional expression
../../gcc-3.4.1/libiberty/regex.c:4558: warning: signed and unsigned type in conditional expression
../../gcc-3.4.1/libiberty/regex.c:4558: warning: signed and unsigned type in conditional expression
../../gcc-3.4.1/libiberty/regex.c: In function `xregcomp':
../../gcc-3.4.1/libiberty/regex.c:8043: warning: signed and unsigned type in conditional expression
../../gcc-3.4.1/libiberty/regex.c: In function `xregerror':
../../gcc-3.4.1/libiberty/regex.c:8178: warning: unused parameter `preg'
/tmp/ccsYrxt9.s: Assembler messages:
/tmp/ccsYrxt9.s:38: Error: Unrecognized opcode: `pushl'
/tmp/ccsYrxt9.s:40: Error: Unrecognized opcode: `movl'
/tmp/ccsYrxt9.s:42: Error: Unrecognized opcode: `pushl'
/tmp/ccsYrxt9.s:44: Error: Unrecognized opcode: `pushl'
/tmp/ccsYrxt9.s:46: Error: Unrecognized opcode: `movl'

. . . [thousands of lines removed]

/tmp/ccsYrxt9.s:18194: Error: unknown pseudo-op: `.value'
/tmp/ccsYrxt9.s:18195: Error: unknown pseudo-op: `.value'
make[1]: *** [regex.o] Error 1
make[1]: Leaving directory `/home/jwong/gcc-build/gcc-3.4.1-objdir/libiberty'
make: *** [all-libiberty] Error 2


=========================================================================


I've also tried just leaving /usr/bin/as as is (making target i686-linux code).  And just add /usr/local/binutils/powerpc-*-eabi/bin to the end of my path.  This does not work.



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-09-08 18:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-08 18:37 FW: Need help in building a PowerPC cross compiler Wong, John

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).